FlowFactoryWithInput

class FlowFactoryWithInput<TInput : CacheableInput.FlowInput, TData, TError : Throwable>(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, flow: (input: TInput) -> Flow<TData>)

Factory for creating CacheableFlowWithInput instances.

The flow lambda runs on Dispatchers.Default. Do not use launch or async inside the lambda without awaiting — the flow collection must complete sequentially so that state transitions (LOADING → SUCCESS/ERROR) are correct.

Constructors

Link copied to clipboard
constructor(cache: OnHandCache, dispatcher: CoroutineDispatcher = Dispatchers.Default, ttl: Duration? = null, flow: (input: TInput) -> Flow<TData>)

Functions

Link copied to clipboard
fun create(startingCacheKey: TInput? = null, coroutineScope: CoroutineScope, initialFetchState: FetchState = FetchState.IDLE): CacheableFlowWithInput<TInput, TData, TError>
Link copied to clipboard
operator fun invoke(startingCacheKey: TInput? = null, coroutineScope: CoroutineScope, initialFetchState: FetchState = FetchState.IDLE): CacheableFlowWithInput<TInput, TData, TError>
Link copied to clipboard
fun optimisticUpdater(input: TInput, updater: (currentValue: TData?) -> TData): Map<TInput, TData?>