what's the idiomatic way of accomplish the same rx...
# coroutines
m
what's the idiomatic way of accomplish the same rx clickListener + textChangedListener, where the click triggers a save and the changedListener just validates some edittext. (clickListener.withLatestFrom(textChangedListener) ?
g
Not sure about required semantics, but you always can propose to add operator
withLatestFrom
with your use case to kotlinx.coroutines issue tracker
m
ya, i am asking because i didn't find any suitable approach to it. But maybe that's because i'm trying to find an rx replacement. if i think more imperativelly, i can just call a function when a click happens and have the problem solved
g
no, I just think that such operator doesn’t exist, you can implement it tho
There is alredy PR with it
for now you can just copy implementation
m
nice 😮 thanks
g
still make sense to create a feature request
o
a smaller but perhaps more expensive workaround I thought up:
Copy code
val clickFlow = ...
val textChangeFlow = ...
val resultFlow = clickFlow.zip(textChangeFlow).distinctUntilChangedBy { it.first }
basically, using the first flow to drive which values are considered part of the flow
👍 1
also requires that the first emits unique values, but for events I think that should suffice