Lilly07/03/2020, 12:36 AM
without an initial value? I have multiple locations where this behaviour makes me trouble. Or to be more concrete: When I write something like this below my state:
val isScanning: Boolean by viewModel.isScanning.collectAsState() // viewModel.isScanning is of type StateFlow<Boolean>
it should not trigger
if (isScanning) viewModel.stopScan() else viewModel.startScan()
when composable function is called. Instead it should trigger on next value change.
Leland Richardson [G]07/03/2020, 4:16 AM
Lilly07/03/2020, 2:19 PM
I'm on dev14 and kotlin 1.3.72. The onCommit callback looks interesting. Can you please explain, when it's triggered, I don't understand the description of the documentation.
StateFlow-specific overload fof collectAsState that does not need an initial value.
Timo Drick07/04/2020, 9:15 AM
Sean McQuillan [G]07/06/2020, 8:46 PM