can anyone provide insight into what the best way ...
# flow
m
can anyone provide insight into what the best way to combine two flows is? I’m currentlly using the actual
combine
operator, but it’s not getting me quite the result I’m after. Here’s an example of what I’ve got now
Copy code
flowOne()
.combine(flowTwo, { a, b -> Pair(a,b) })
.onEach { ... }
While the actual values of the
Pair
i’m creating are correct, as far as I can tell, the values are only updated when
flowOne
emits a value, only then combining with the latest value from
flowTwo
. Is there an elegant operator (or approach) I can use to propagate my
Pair
immediately when either
flowOne
or
flowTwo
update, not just
flowOne
? update: turns out I
combine
is what I want! except, rather than
flowOne.combine(flowTwo)
, I need
combine(flowOne, flowTwo)
:)
i’ve used
zip
in the past with
Rx
but I think that’s also probably not what I’m looking for
m
They should both do what you need