I guess more of a design pattern problem. If I hav...
# coroutines
j
I guess more of a design pattern problem. If I have a view model on Android that has 3 flows that it needs to collect from when the view opens, but the flows may need to be restarted based on an event, what is the standard safe way to do this?
g
needs to be restarted? Looks as a case for flatMapLatest But maybe you have an example of what you trying to achieve
👍 1
u
have a trigger MutableSharedFlow and use flatMapLatest .. each emit into the trigger will resubscribe the body of the flatmap, restarting it if it is cold
👍 1
💯 1
j
Thanks guys, definitely overthought it. flatMapLatest and your suggestion makes sense!