# MutableRedeliverStateFlow

open class MutableRedeliverStateFlow < T >(initialValue: T ) : MutableStateFlow< T > , FlowCollector< T > , MutableSharedFlow< T > (source)

Works like StateFlow, but guarantee that latest value update will always be delivered to each active subscriber

## Constructors

MutableRedeliverStateFlow
Link copied to clipboard
constructor(initialValue: T )

## Properties

replayCache
Link copied to clipboard
open override val replayCache : List < T >
subscriptionCount
Link copied to clipboard
open override val subscriptionCount : StateFlow< Int >
value
Link copied to clipboard
open override var value : T

## Functions

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, useContextOnChange: CoroutineContext ? = Dispatchers.Main, noinline onException: ExceptionHandler < List < T >?> = defaultSafelyWithoutExceptionHandlerWithNull): List < T >

In fact, it is just classcast of asMutableComposeListState to List

asComposeState
Link copied to clipboard
inline fun < T > StateFlow< T >. asComposeState (scope: CoroutineScope, useContextOnChange: CoroutineContext ? = Dispatchers.Main, noinline onException: ExceptionHandler < T ?> = defaultSafelyWithoutExceptionHandlerWithNull): ERROR CLASS: Ambiguity: State, [kotlin/collections/State, kotlin/sequences/State]<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: Ambiguity: State, [kotlin/collections/State, kotlin/sequences/State]<T>

Will create MutableState using asMutableComposeState and use asState to convert it as immutable state

asMutableComposeListState
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: Symbol not found for SnapshotStateList<T>

Each value of this will trigger applyDiff to the result SnapshotStateList

asMutableComposeState
Link copied to clipboard
inline fun < T > StateFlow< T >. asMutableComposeState (scope: CoroutineScope, useContextOnChange: CoroutineContext ? = Dispatchers.Main, noinline onException: ExceptionHandler < T ?> = defaultSafelyWithoutExceptionHandlerWithNull): ERROR CLASS: Symbol not found for MutableState<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: Symbol not found for MutableState<T>

Will map this as MutableState. Returned MutableState WILL NOT change source Flow

collect
Link copied to clipboard
open suspend override fun collect (collector: FlowCollector< T >): Nothing
compareAndSet
Link copied to clipboard
open override fun compareAndSet (expect: T , update: T ): Boolean
debouncedBy
Link copied to clipboard
fun < T > Flow< T >. debouncedBy (timeout: ( T ) -> Long , markerFactory: ( T ) -> Any ?): Flow< T >

Debounces a Flow with per-marker timeout control. Values with the same marker will be debounced independently. For each marker, only the last value within the timeout period will be emitted.

fun < T > Flow< T >. debouncedBy (timeout: Long , markerFactory: ( T ) -> Any ?): Flow< T >

Debounces a Flow with a fixed timeout in milliseconds and per-marker control. Values with the same marker will be debounced independently.

fun < T > Flow< T >. debouncedBy (timeout: Duration , markerFactory: ( T ) -> Any ?): Flow< T >

Debounces a Flow with a fixed timeout as Duration and per-marker control. Values with the same marker will be debounced independently.

emit
Link copied to clipboard
open suspend override fun emit (value: T )
filterNotNull
Link copied to clipboard
fun < T > Flow< T >. filterNotNull (): Flow< T & Any >

Alias for takeNotNull. Filters out null values from this Flow, returning only non-null elements.

firstNotNull
Link copied to clipboard
suspend fun < T > Flow< T ?>. firstNotNull (): T & Any

Returns the first non-null element emitted by this Flow. Suspends until a non-null element is found.

flatMap
Link copied to clipboard
@ JvmName (name = "flatMapIterable")
inline fun < T , R > Flow< Iterable < T >>. flatMap (crossinline mapper: suspend ( T ) -> R ): Flow< R >

Transforms each element from inner Iterables using the given mapper function and flattens the result into a single Flow.

inline fun < T , R > Flow<Flow< T >>. flatMap (crossinline mapper: suspend ( T ) -> R ): Flow< R >

Transforms each inner Flow element using the given mapper function and flattens the result into a single Flow.

flatMapNotNull
Link copied to clipboard
@ JvmName (name = "flatMapNotNullIterable")
inline fun < T , R > Flow< Iterable < T >>. flatMapNotNull (crossinline mapper: suspend ( T ) -> R ): Flow< R & Any >

Transforms each element from inner Iterables using the given mapper function, flattens the result, and filters out null values.

inline fun < T , R > Flow<Flow< T >>. flatMapNotNull (crossinline mapper: suspend ( T ) -> R ): Flow< R & Any >

Transforms each inner Flow element using the given mapper function, flattens the result, and filters out null values.

flatten
Link copied to clipboard
@ JvmName (name = "flattenIterable")
fun < T > Flow< Iterable < T >>. flatten (): Flow< T >

Flattens a Flow of Iterables into a single Flow by emitting all elements from each iterable.

fun < T > Flow<Flow< T >>. flatten (): Flow< T >

Flattens a Flow of Flows into a single Flow by collecting all inner flows sequentially.

invoke
Link copied to clipboard
inline suspend operator fun < T > FlowCollector< T >. invoke (value: T )

Operator function that allows a FlowCollector to be invoked like a function to emit a value. This is a convenient syntax sugar for FlowCollector.emit.

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 >

Merges two flows into a single flow. Values from both flows will be emitted as they become available. This is a convenient operator syntax for merge.

resetReplayCache
Link copied to clipboard
@ExperimentalCoroutinesApi
open override fun resetReplayCache ()
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 , logger: KSLog = KSLog, block: suspend ( T ) -> Unit ): Job

Subscribes to a Flow with asynchronous processing based on markers. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially in the same coroutine scope, while values with different markers can be processed concurrently in separate coroutine scopes.

subscribeLogging
Link copied to clipboard
inline fun < T > Flow< T >. subscribeLogging (scope: CoroutineScope, noinline errorMessageBuilder: T .( Throwable ) -> Any = { "Something web wrong" }, logger: KSLog = KSLog, 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

subscribeLoggingDropExceptions
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

subscribeLoggingDropExceptionsAsync
Link copied to clipboard
fun < T , M > Flow< T >. subscribeLoggingDropExceptionsAsync (scope: CoroutineScope, markerFactory: suspend ( T ) -> M , logger: KSLog = KSLog, block: suspend ( T ) -> Unit ): Job

Subscribes to a Flow with asynchronous processing based on markers, automatically logging and dropping exceptions. Each value from the flow will be processed by the block function. Values with the same marker will be processed sequentially, while values with different markers can be processed concurrently. Any exceptions thrown during processing will be logged and dropped without affecting other messages.

takeNotNull
Link copied to clipboard
fun < T > Flow< T >. takeNotNull (): Flow< T & Any >

Filters out null values from this Flow, returning only non-null elements.

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