Justin Xu
05/27/2023, 7:15 AMMutableStateFlow
variable becomes a certain value, what is the best approach to do that in a Composable? I know that Composables should mostly be side-effect effect free, and this action definitely seems like a side effecthfhbd
05/27/2023, 7:16 AMJustin Xu
05/27/2023, 7:26 AMval result = stateFlow.collectAsStateWithLifecycle()
when(result) {
is Result.SwitchScreen1 -> {
// Push Screen1
}
is Result.SwitchScreen2 -> {
// Push Screen2
}
...
}
This logic is safe to include inside a composable?hfhbd
05/27/2023, 7:36 AMJustin Xu
05/27/2023, 8:33 AMnavigator.push(Screen1())
without giving it any state. Not sure if that countsFrancesc
05/27/2023, 3:45 PMFrancesc
05/27/2023, 3:47 PMJustin Xu
05/27/2023, 4:55 PM