mcpiroman
11/06/2021, 8:40 PMFlow
.
Yet, official jetpack compose codelab does use it quite extensively (although switches out of it at the end).
If the first line is true, I think this guide should not suggest it at all, maybe just mention it as a possibility.
Even if `LiveData`is as OK as the former options it introduces unnecessary complexity and decision-branches.tad
11/07/2021, 3:08 AMIan Lake
11/07/2021, 6:38 AMFlow.collectAsState()
will continue to collect even after you hit the home button and you're back on the launcher (as your activity is stopped, but not destroyed - thus your UI is not disposed). You'd need to use flowWithLifecycle
if you want it to stop collecting once your activity is no longer visible: https://medium.com/androiddevelopers/a-safer-way-to-collect-flows-from-android-uis-23080b1f8bda#27a9Ian Lake
11/07/2021, 6:39 AMLiveData
, FWIW