With zip
or combine
it's only possible to combine only 2 flows if i don't miss anything, i wasn't able to see any public method that combines list of flows or vararg
.
for instance
apiHelper.getUsers()
.zip(apiHelper.getMoreUsers()) { usersFromApi, moreUsersFromApi ->
val allUsersFromApi = mutableListOf<ApiUser>()
allUsersFromApi.addAll(usersFromApi)
allUsersFromApi.addAll(moreUsersFromApi)
return@zip allUsersFromApi
}
i need first 5 pages from REST api, and fetch them in parallel and combine the result, do some mapping, and filtering on combined data. Can i combine them with flow
or should i pass coroutineScope and use async for having parallel requests?
I checked out the answer here but it returns compile error, and there seems to be no public combine function for flow that takes list as parameter.