Robert Jaros
12/14/2021, 6:31 PM1.6.0-RC
, but in 1.6.0-RC2
it's not working anymore because the collect
extension function was removed with https://github.com/Kotlin/kotlinx.coroutines/pull/3047 :
val stateFlow = MutableStateFlow(State())
val actionFlow = MutableSharedFlow<Action>()
launch {
actionFlow.collect {
stateFlow.value = stateReducer(stateFlow.value, it)
}
}
What is the correct way to implement this?launch {
actionFlow.onEach {
stateFlow.value = stateReducer(stateFlow.value, it)
}.collect()
}
Alex Vanyo
12/14/2021, 6:43 PMdevelop
that is removing the @InternalCoroutinesApi
on the actual Flow.collect
, which I think should allow old source code to compile as-ishfhbd
12/14/2021, 6:45 PMRobert Jaros
12/14/2021, 6:46 PM