rkechols
01/08/2022, 10:50 AMGroup
object, which has some normal data to display (e.g. id
), but also has a list of User
objects (which each have their own data to display)
I'd of course like my database to have group data separated from the User
data, since `User`s can exist without a group, with multiple groups, etc. So, each group in the db will simply list the relevant User
IDs; I call this a ShallowGroup
I know how to get a flow to observe a single User
, or how to get a flow to observe a single ShallowGroup
but I can't figure out how to get from those a flow that produces full Group
objects that reflect the changes to the inner User
objects.
My best understanding of how it would work:
1. Get a flow of ShallowGroup
objects.
2. In a map
call on that flow, use the user IDs in that ShallowGroup
snapshot to get a flow for each User
, and:
3. use combine
on the previous list of flows of Users
to get a flow which produces `List<User>`/`Group`
4. ?? somehow flatten the Flow<Flow<Group>>
to just a Flow<Group>
??
Note that the contents of each ShallowGroup
object received determine which User
objects need to be observed.
Can someone point me to what the best way is to handle flows for nested objects like this?louiscad
01/08/2022, 11:36 AMursus
01/08/2022, 12:14 PM