Let's say I have this flow ```fun loadUsersByRegio...
# flow
p
Let's say I have this flow
Copy code
fun loadUsersByRegion(regions: List<String>): Flow<List<User>>
I want to call fetchInfo on each item without nesting map....
Copy code
fun fetchInfo(user: User): Info
is there any better?
Copy code
.flatMapConcat { users ->
            flow {
                val usersInfo = users.map { user -> fetchInfo(user) }
                emit(usersInfo)
            }
        }
c
Why does
loadUserByRegion
return a
Flow<List<User>>
instead of a
Flow<User>
?
p
that is the how roomdb return all
c
If you don't care about the list, just flatten first
Copy code
loadUsersByRegaion(…)
    .flatMapConcat { it.asFlow() }
    .map { fetchInfo(it) }
🙌 1