Lilly
07/03/2020, 12:36 AMval isScanning: Boolean by viewModel.isScanning.collectAsState() // viewModel.isScanning is of type StateFlow<Boolean>
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:
if (isScanning) viewModel.stopScan() else viewModel.startScan()
it should not trigger stopScan()
nor startScan()
when composable function is called. Instead it should trigger on next value change.Leland Richardson [G]
07/03/2020, 4:16 AMLeland Richardson [G]
07/03/2020, 4:18 AMLilly
07/03/2020, 2:19 PMStateFlow-specific overload fof collectAsState that does not need an initial value.
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.Timo Drick
07/04/2020, 9:15 AMTimo Drick
07/04/2020, 9:15 AMSean McQuillan [G]
07/06/2020, 8:46 PM