zip2<A, B, R> method

ZipStream<dynamic, R> zip2 <A, B, R>(
  1. Stream<A> streamOne,
  2. Stream<B> streamTwo,
  3. R zipper(
    1. A a,
    2. B b
    )
)

Constructs a Stream which merges the specified Streams into a sequence using the given zipper Function, whenever all of the provided Streams have produced an element at a corresponding index.

Implementation

static ZipStream<dynamic, R> zip2<A, B, R>(
  Stream<A> streamOne,
  Stream<B> streamTwo,
  R Function(A a, B b) zipper,
) {
  return ZipStream<dynamic, R>(
    [streamOne, streamTwo],
    (List<dynamic> values) => zipper(values[0] as A, values[1] as B),
  );
}