how do I emulate the same behavior that Observable...
# coroutines
o
how do I emulate the same behavior that Observable.combineLatest does? I have that inside a viewmodel and when I leave the screen and come back, that line is triggered again and fetches the values i’m requesting again if I just have viewModelSCope.Launch ( my stuff), it doesn’t get retriggered when coming back with new values
n
Basic equivalent is
combine
. If your Rx was emitting an item whenever your activity resumes/starts, I'm guessing that you were re-subscribing each time? You need to do the same with
Flow
. ViewModelScope lasts accross multiple Activities so it's not going to re-subscribe. You could look at something like
repeatOnLifecycle
or
flowWithLifecycle
.
o
I see..
and inside it run the coroutines