https://kotlinlang.org logo
Title
l

Lauren Yew

01/07/2021, 7:50 PM
Is there a way for me to be able to create something like a
MutableStateFlow
without an initial state? I.e. I want a flow that I can make into a variable and reference and send data but I don't want to specify an initial state.
j

Javier

01/07/2021, 8:00 PM
normal flow + stateIn probably
suspend fun <T> Flow<T>.stateIn( scope: CoroutineScope ): StateFlow<T> Starts the upstream flow in a given scope, suspends until the first value is emitted, and returns a hot StateFlow of future emissions, sharing the most recently emitted value from this running instance of the upstream flow with multiple downstream subscribers. See the StateFlow documentation for the general concepts of state flows.