Hi everyone, how do I convert a `List<Flow<T...
# coroutines
t
Hi everyone, how do I convert a
List<Flow<T>>
to a
Flow<List<T>>
? Sounds simple enough but it's bugging my brain 😅
w
combine
?
👍 2
j
I think it depends on what you want to happen. There is the combine function that you can use, but it might not be the behaviour you expect:
Copy code
combine(flows) { mostRecentValuesInEach -> 
    mostRecentValuesInEach.toList()
}
👍 1
t
Yep, thats it, thanks guys 🎉
j
Note that this will emit a new list each time one of the flows has a new value, thus re-emitting the last element of all other flows. Is that what you want?
t
Yep!
👌 1