combine2<A, B, R> method

CombineLatestStream<dynamic, R> combine2 <A, B, R>(Stream<A> streamOne, Stream<B> streamTwo, R combiner(A a, 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 combiner(A a, B b),
) {
  return CombineLatestStream<dynamic, R>(
    [streamOne, streamTwo],
    (List<dynamic> values) => combiner(values[0] as A, values[1] as B),
  );
}