combine2<A, B, R> static method

ForkJoinStream<dynamic, R> combine2<A, B, R>(
  1. Stream<A> streamOne,
  2. Stream<B> streamTwo,
  3. R combiner(
    1. A a,
    2. B b
    )
)

Constructs a Stream that awaits the last values the provided Streams, then calls the combiner to emit an event of type R. After this event, the Stream closes.

Implementation

static ForkJoinStream<dynamic, R> combine2<A, B, R>(
  Stream<A> streamOne,
  Stream<B> streamTwo,
  R Function(A a, B b) combiner,
) =>
    ForkJoinStream<dynamic, R>(
      [streamOne, streamTwo],
      (List<dynamic> values) => combiner(values[0] as A, values[1] as B),
    );