here is my use case:
I have two different Observables
:
Observable<MobileAdEvent> adEventStream;
Observable<Color> colorStream;
I need to receive notification when either of those two emits an event. zipWith
does not work for me, since it waits until both streams has an event to emit. mergeWith
also does not seem to work, since it expects both stream to be from the same type.
Any hints would be greatly appreciated,
Thanks.
What you want is combineLatest
operator
Observable<Foo> foo;
Observable<Bar> bar;
final output = Observable.combineLatest2(foo, bar, (Foo foo, Bar bar) {
// TODO: somehow merge them
});