firstFlow.combine(secondFlow) { text: String, role: Role ->
repository.getProcessList(role.apiParam, text)//returns new flow each time
}.flatMapLatest {
it
}
m
myanmarking
04/29/2022, 8:27 AM
that won’t do what you expect. Just make it a Pair in the combine lambda, and then in the flatMapLatest use your flow
myanmarking
04/29/2022, 8:28 AM
firstFlow.combine(secondFlow) { text: String, role: Role -> role.apiParam to text }
.flatMapLatest { (apiParam, text) ->
repository.getProcessList(apiParam, text)
}
i
ildar.i [Android]
04/29/2022, 8:33 AM
thank you, this looks better
j
julian
04/29/2022, 5:18 PM
Harder, but an interesting exercise - implement a
combineLatest
operator, and use it followed by
flatten
.
combineLatest
would combine the latest emissions of the source flows and switch to the latest flow returned by its