I have database query that returns the list of indexes of objects for a certain day, i.e.:
getIndexesOfDay(day: Day): Flow<List<String>>
Now, I need to listen for details for each index, for instance:
getDetailsByIndex(index: String): Flow<Details>
So the question is: how can I accomplish this using Flows?
Two important constraints:
- Changes on the indexes should propagate to the final flow;
- Changes on any
Detailsobject should also update the flow.
What I have already tried:
getIndexesOfDay(todayDay)
.map { indexes ->
indexes?.map {
mIndex->
getDetailsByIndex(mIndex)
}
}
But it returns a Flow<List<Flow<Details>>> instead of the desired Flow<List<Details>>
Appreciate any help!