zip2<R, A, B> function

EventSubscriptionBuilder<R> zip2<R, A, B>(
  1. EventSubscriptionBuilder<A> eventA,
  2. EventSubscriptionBuilder<B> eventB,
  3. R zipper(
    1. A a,
    2. B b
    )
)

Zips the values of each provided event using the zipper into a single output EventHandler when all handlers have emitted at each index.

See zip.

Implementation

EventSubscriptionBuilder<R> zip2<R, A, B>(
  EventSubscriptionBuilder<A> eventA,
  EventSubscriptionBuilder<B> eventB,
  R Function(A a, B b) zipper,
) {
  return zip(
    [eventA, eventB],
    (values) {
      final a = values[0] as A;
      final b = values[1] as B;

      return zipper(a, b);
    },
  );
}