Show your ViewModel, how is your StateFlow instantiated?
Stylianos Gakis
02/29/2024, 12:45 PM
If you use .stateIn() you can pass in there if you want it to cache the last emitted value or not.
And in your UI you just gotta do observeAsStateWithLifecycle to ensure that the StateFlow stops being hot when that screen is not available.
You then avoid doing any launched effects or whatever to solve this