asComposeState

fun <T> Flow<T>.asComposeState(initial: T, scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>(source)

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

Parameters

initial

First value which will be passed to the result State

scope

Will be used to subscribeSafelyWithoutExceptions on this to update returned State

useContextOnChange

Will be used to change context inside of subscribeSafelyWithoutExceptions to ensure that change will happen in the required CoroutineContext. Dispatchers.Main by default

onException

Will be passed to the subscribeSafelyWithoutExceptions as uncaught exceptions handler


inline fun <T> StateFlow<T>.asComposeState(scope: CoroutineScope, useContextOnChange: CoroutineContext? = Dispatchers.Main, noinline onException: ExceptionHandler<T?> = defaultSafelyWithoutExceptionHandlerWithNull): <Error class: unknown class><T>(source)

Will map this as State. This conversation will pass its StateFlow.value as the first value

Parameters

scope

Will be used to subscribeSafelyWithoutExceptions on this to update returned State

useContextOnChange

Will be used to change context inside of subscribeSafelyWithoutExceptions to ensure that change will happen in the required CoroutineContext. Dispatchers.Main by default

onException

Will be passed to the subscribeSafelyWithoutExceptions as uncaught exceptions handler