I have a flow with ids, and I wanna to get flow of database objects. I’m trying to do it like this:
indicesFlow
.map { indices ->
database.usersQueries
.getBy(indices)
.asFlow()
.mapToList()
}
.flattenConcat()
.collect { users ->
}
For some reason map gets called only for the first emitted item, and when I emit new indices to
indexesFlow
it’s not get called anymore and so collect it not get called too. I expect old database flow to be cancelled and be replaced with a new one.
And if I replace database flow with a basic flow with emit, same code work fine for new indexesFlow emits
indicesFlow
.map { indices ->
flow {
emit("$indices")
}
}
.flattenConcat()
.collect { strings ->
}
I’m just starting exploring flows, what am I missing here?