Jeremie D
02/27/2025, 4:34 PMSeri
02/27/2025, 4:40 PMFlow
to represent the stream of state? If so, you can launch a tracking coroutine pretty easily.Jeremie D
02/27/2025, 4:40 PMJeremie D
02/27/2025, 4:41 PMSeri
02/27/2025, 4:41 PMprivate val state = MutableStateFlow(initialState)
init {
viewModelScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) {
state.filter { ... }
.onEach { ... }
}
}
Seri
02/27/2025, 4:42 PMstate
, that coroutine will reactively perform your side effectJeremie D
02/27/2025, 4:44 PMSeri
02/27/2025, 4:44 PMSeri
02/27/2025, 4:44 PMWinson Chiu
02/27/2025, 4:50 PMonClick
is never invoked twice for an event regardless of how many recompositions happen.Winson Chiu
02/27/2025, 4:52 PM