combine2<A, B, R> method

CombineLatestStream<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 CombineLatestStream from a pair of Streams where combiner is used to create a new event of type R, based on the latest events emitted by the provided Streams.

Implementation

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