withLatestFrom3<A, B, C, R> method

Stream<R> withLatestFrom3<A, B, C, R>(
  1. Stream<A> latestFromStream1,
  2. Stream<B> latestFromStream2,
  3. Stream<C> latestFromStream3,
  4. R fn(
    1. T t,
    2. A a,
    3. B b,
    4. C c,

Creates a Stream that emits when the source stream emits, combining the latest values from the four streams using the provided function.

If any of latestFromStreams has not emitted any values, this stream will not emit either.

Interactive marble diagram


Stream.fromIterable([1, 2])
    Stream.fromIterable([2, 3]),
    Stream.fromIterable([3, 4]),
    Stream.fromIterable([4, 5]),
    (int a, int b, int c, int d) => a + b + c + d,
  .listen(print); // prints 11 (due to the async nature of streams)


Stream<R> withLatestFrom3<A, B, C, R>(
  Stream<A> latestFromStream1,
  Stream<B> latestFromStream2,
  Stream<C> latestFromStream3,
  R Function(T t, A a, B b, C c) fn,
) =>
    WithLatestFromStreamTransformer.with3<T, A, B, C, R>(