<@UHAJKUSTU> the latest version has a new stateflo...
# mvikotlin
f
@Arkadii Ivanov the latest version has a new stateflow to observe state. Do you have a sample how we can use it ???
a
No, as far as I know. But this should be essentially the same as with usual
state.states
.
f
so we do not need use
Value<out T : Any>
anymore
a
I mean you can use the new API, or you can continue using Value. MVIKotlin can be used without Decompose. 😀
f
ok. I want use the new API together with Decompose.
Copy code
interface ScanComponent {
    val states: Flow<ScanStore.State>
}
Copy code
class ScanComponentImpl {
    override val states: StateFlow<ScanStore.State> = store.stateFlow
}
And in the UI a call
val uistate by component.states.collectAsState(null)
. Everything works like a charm but the collectAsState need for initial state and the
uistate
can be null. The store has an initial state, so it is interesting collectAsState to wait the store emit the first state. Do you have some idea???
a
I think you need to use StateFlow in your ScanComponent interface.
f
You are right as always
thank you so much
a