with1<T, S, R> static method

WithLatestFromStreamTransformer<T, S, R> with1<T, S, R>(
  1. Stream<S> latestFromStream,
  2. R fn(
    1. T t,
    2. S s
    )
)

Constructs a StreamTransformer that emits when the source Stream emits, combining the latest values from latestFromStream using the provided function fn.

Implementation

static WithLatestFromStreamTransformer<T, S, R> with1<T, S, R>(
  Stream<S> latestFromStream,
  R Function(T t, S s) fn,
) =>
    WithLatestFromStreamTransformer<T, S, R>(
      [latestFromStream],
      (s, values) => fn(s, values[0]),
    );