Special Mutable State Flow
Functions
Link copied to clipboard
Creates AccumulatorFlow using this as base Flow
Link copied to clipboard
inline fun <T> Flow<List<T>>.asComposeList(scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, noinline onException: ExceptionHandler<List<T>?> = defaultSafelyWithoutExceptionHandlerWithNull): List<T>
In fact, it is just classcast of asMutableComposeListState to List
Link copied to clipboard
inline fun <T> StateFlow<T>.asComposeState(scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>
Will map this as State. This conversation will pass its StateFlow.value as the first value
fun <T> Flow<T>.asComposeState(initial: T, scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>
Will create MutableState using asMutableComposeState and use asState to convert it as immutable state
Link copied to clipboard
inline fun <T> Flow<List<T>>.asMutableComposeListState(scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, noinline onException: ExceptionHandler<List<T>?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>
Each value of this will trigger applyDiff to the result SnapshotStateList
Link copied to clipboard
inline fun <T> StateFlow<T>.asMutableComposeState(scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>
Will map this as MutableState. Returned MutableState WILL NOT change source StateFlow. This conversation will pass its StateFlow.value as the first value
fun <T> Flow<T>.asMutableComposeState(initial: T, scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>
Will map this as MutableState. Returned MutableState WILL NOT change source Flow
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun Flow<Int>.mapRequireFilling(minimalLeftItems: Int, crossinline countGetter: () -> Int): Flow<Int>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <T> Flow<T>.subscribeLoggingDropExceptions(scope: CoroutineScope, noinline errorMessageBuilder: T.(Throwable) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, noinline block: suspend (T) -> Unit): Job
Use subscribeSafelyWithoutExceptions, but all exceptions will be passed to defaultSafelyExceptionHandler
Link copied to clipboard
fun <T, M> Flow<T>.subscribeSafelyAsync(scope: CoroutineScope, markerFactory: suspend (T) -> M, onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler, block: suspend (T) -> Unit): Job
Link copied to clipboard
Link copied to clipboard
fun <T, M> Flow<T>.subscribeSafelyWithoutExceptionsAsync(scope: CoroutineScope, markerFactory: suspend (T) -> M, onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull, block: suspend (T) -> Unit): Job
Link copied to clipboard