MutableFlow

interface MutableFlow<T> : Flow<T> , FlowCollector<T>

A Flow where you can emit/tryEmit values into (backed by a Channel).

Inheritors

Functions

Link copied to clipboard
fun <T> Flow<T>.addDelay(timeoutMillis: Long): Flow<T>

Adds a timeoutMillis delay to a Flow. If delay is zero or negative this is a no-op.

Link copied to clipboard
abstract fun cancel()
Link copied to clipboard
abstract suspend fun collect(collector: FlowCollector<T>)
Link copied to clipboard
inline fun <T, R> Flow<T>.conflatedMap(timeoutMillis: Long = 0, crossinline transform: suspend (value: T) -> R): Flow<R>

Maps a conflated Flow with timeoutMillis delay between the first and last element.

Link copied to clipboard
inline fun <T, R> Flow<T>.conflatedTransform(timeoutMillis: Long = 0, crossinline transform: suspend FlowCollector<R>.(value: T) -> Unit): Flow<R>

Transforms a conflated Flow with timeoutMillis delay between the first and last element.

Link copied to clipboard
fun <T, R> Flow<T>.conflatedWorker(timeoutMillis: Long = 0, transform: FlowTransform<T, R>): Flow<R>

Executes each lambda in a Flow using conflatedMap.

Link copied to clipboard
fun <T, R> Flow<T>.debounceWorker(timeoutMillis: Long = 0, transform: FlowTransform<T, R>): Flow<R>

Executes each lambda in a Flow using debounce and map.

Link copied to clipboard
abstract suspend fun emit(value: T)
Link copied to clipboard
abstract fun isEmpty(): Boolean
Link copied to clipboard
fun <T, R> Flow<T>.latestWorker(timeoutMillis: Long = 0, transform: FlowTransform<T, R>): Flow<R>

Executes each lambda in a Flow using debounce and mapLatest.

Link copied to clipboard
fun <T> Flow<T>.shareOnDemand(replay: Int = 0, context: CoroutineContext = EmptyCoroutineContext): SharedFlow<T>

Turns this Flow into a SharedFlow without requiring a CoroutineScope (unlike shareIn).

Link copied to clipboard
fun <T> Flow<T>.stateOnDemand(initial: T, context: CoroutineContext = EmptyCoroutineContext, synchronous: Boolean = true, emitValueOnStart: Boolean = true): StateFlow<T>
fun <T> Flow<T>.stateOnDemand(context: CoroutineContext = EmptyCoroutineContext, synchronous: Boolean = true, emitValueOnStart: Boolean = true, getter: (previous: Wrapped<T>?) -> T): StateFlow<T>

Turns this Flow into a StateFlow without requiring a CoroutineScope (unlike stateIn).

Link copied to clipboard
abstract fun tryEmit(value: T): Boolean

Adds a value to this Flow if there's still capacity left.