micro_utils.dokka
0.15.1

# AccumulatorFlow

class AccumulatorFlow<T>(sourceDataFlow: Flow<T>, scope: CoroutineScope) : AbstractFlow<T>

This Flow will have behaviour very similar to SharedFlow, but there are several differences:

- All unhandled by FlowCollector data will not be removed from AccumulatorFlow and will be sent to new FlowCollectors until anybody will handle it

- Here there are an activeData where data T will be stored until somebody will handle it

## Constructors

AccumulatorFlow
Link copied to clipboard
fun <T> AccumulatorFlow(sourceDataFlow: Flow<T>, scope: CoroutineScope)

## Functions

collect
Link copied to clipboard
suspend override fun collect(collector: FlowCollector<T>)
collectSafely
Link copied to clipboard
open suspend override fun collectSafely(collector: FlowCollector<T>)

## Extensions

accumulatorFlow
Link copied to clipboard
fun <T> Flow<T>.accumulatorFlow(scope: CoroutineScope): Flow<T>

Creates AccumulatorFlow using this as base Flow

asComposeList
Link copied to clipboard
inline fun <T> Flow<List<T>>.asComposeList(scope: CoroutineScope): List<T>
asComposeState
Link copied to clipboard
fun <T> Flow<T>.asComposeState(initial: T, scope: CoroutineScope): <Error class: unknown class><T>
asMutableComposeListState
Link copied to clipboard
inline fun <T> Flow<List<T>>.asMutableComposeListState(scope: CoroutineScope): <Error class: unknown class><T>
asMutableComposeState
Link copied to clipboard
fun <T> Flow<T>.asMutableComposeState(initial: T, scope: CoroutineScope): <Error class: unknown class><T>
filterNotNull
Link copied to clipboard
fun <T> Flow<T>.filterNotNull(): Flow<T & Any>
firstNotNull
Link copied to clipboard
suspend fun <T> Flow<T?>.firstNotNull(): T
flatMap
Link copied to clipboard
inline fun <T, R> Flow<Flow<T>>.flatMap(crossinline mapper: suspend (T) -> R): Flow<R>
@JvmName(name = "flatMapIterable")
inline fun <T, R> Flow<Iterable<T>>.flatMap(crossinline mapper: suspend (T) -> R): Flow<R>
flatMapNotNull
Link copied to clipboard
inline fun <T, R> Flow<Flow<T>>.flatMapNotNull(crossinline mapper: suspend (T) -> R): Flow<R & Any>
@JvmName(name = "flatMapNotNullIterable")
inline fun <T, R> Flow<Iterable<T>>.flatMapNotNull(crossinline mapper: suspend (T) -> R): Flow<R & Any>
flatten
Link copied to clipboard
fun <T> Flow<Flow<T>>.flatten(): Flow<T>
@JvmName(name = "flattenIterable")
fun <T> Flow<Iterable<T>>.flatten(): Flow<T>
mapLeftItems
Link copied to clipboard
inline fun Flow<Int>.mapLeftItems(crossinline countGetter: () -> Int): Flow<Int>
mapRequireFilling
Link copied to clipboard
inline fun Flow<Int>.mapRequireFilling(minimalLeftItems: Int, crossinline countGetter: () -> Int): Flow<Int>
plus
Link copied to clipboard
inline operator fun <T> Flow<T>.plus(other: Flow<T>): Flow<T>
subscribe
Link copied to clipboard
inline fun <T> Flow<T>.subscribe(scope: CoroutineScope, noinline block: suspend (T) -> Unit): Job

Shortcut for chain if Flow.onEach and Flow.launchIn

subscribeAsync
Link copied to clipboard
fun <T, M> Flow<T>.subscribeAsync(scope: CoroutineScope, markerFactory: suspend (T) -> M, block: suspend (T) -> Unit): Job
subscribeSafely
Link copied to clipboard
inline fun <T> Flow<T>.subscribeSafely(scope: CoroutineScope, noinline onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler, noinline block: suspend (T) -> Unit): Job

Use subscribe, but all blocks will be called inside of safely function. Use onException to set up your reaction for Throwables

subscribeSafelyAsync
Link copied to clipboard
inline fun <T, M> Flow<T>.subscribeSafelyAsync(scope: CoroutineScope, noinline markerFactory: suspend (T) -> M, noinline onException: ExceptionHandler<Unit> = defaultSafelyExceptionHandler, noinline block: suspend (T) -> Unit): Job
subscribeSafelySkippingExceptions
Link copied to clipboard
inline fun <T> Flow<T>.subscribeSafelySkippingExceptions(scope: CoroutineScope, noinline block: suspend (T) -> Unit): Job

Use subscribeSafelyWithoutExceptions, but all exceptions inside of safely will be skipped

subscribeSafelySkippingExceptionsAsync
Link copied to clipboard
inline fun <T, M> Flow<T>.subscribeSafelySkippingExceptionsAsync(scope: CoroutineScope, noinline markerFactory: suspend (T) -> M, noinline block: suspend (T) -> Unit): Job
subscribeSafelyWithoutExceptions
Link copied to clipboard
inline fun <T> Flow<T>.subscribeSafelyWithoutExceptions(scope: CoroutineScope, noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull, noinline block: suspend (T) -> Unit): Job

Use subscribeSafelyWithoutExceptions, but all exceptions will be passed to defaultSafelyExceptionHandler

subscribeSafelyWithoutExceptionsAsync
Link copied to clipboard
inline fun <T, M> Flow<T>.subscribeSafelyWithoutExceptionsAsync(scope: CoroutineScope, noinline markerFactory: suspend (T) -> M, noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull, noinline block: suspend (T) -> Unit): Job
takeNotNull
Link copied to clipboard
fun <T> Flow<T>.takeNotNull(): Flow<T & Any>
toMutableState
Link copied to clipboard
fun <T> Flow<T>.toMutableState(initial: T, scope: CoroutineScope): <Error class: unknown class><T>