with8<T, A, B, C, D, E, F, G, H, R> method

WithLatestFromStreamTransformer<T, dynamic, R> with8 <T, A, B, C, D, E, F, G, H, R>(
  1. Stream<A> latestFromStream1,
  2. Stream<B> latestFromStream2,
  3. Stream<C> latestFromStream3,
  4. Stream<D> latestFromStream4,
  5. Stream<E> latestFromStream5,
  6. Stream<F> latestFromStream6,
  7. Stream<G> latestFromStream7,
  8. Stream<H> latestFromStream8,
  9. R fn(
    1. T t,
    2. A a,
    3. B b,
    4. C c,
    5. D d,
    6. E e,
    7. F f,
    8. G g,
    9. H h
    )
)

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

Implementation

static WithLatestFromStreamTransformer<T, dynamic, R>
    with8<T, A, B, C, D, E, F, G, H, R>(
  Stream<A> latestFromStream1,
  Stream<B> latestFromStream2,
  Stream<C> latestFromStream3,
  Stream<D> latestFromStream4,
  Stream<E> latestFromStream5,
  Stream<F> latestFromStream6,
  Stream<G> latestFromStream7,
  Stream<H> latestFromStream8,
  R Function(T t, A a, B b, C c, D d, E e, F f, G g, H h) fn,
) {
  if (fn == null) {
    throw ArgumentError('Combiner cannot be null');
  }
  return WithLatestFromStreamTransformer<T, dynamic, R>(
    [
      latestFromStream1,
      latestFromStream2,
      latestFromStream3,
      latestFromStream4,
      latestFromStream5,
      latestFromStream6,
      latestFromStream7,
      latestFromStream8,
    ],
    (s, values) {
      return fn(
        s,
        values[0] as A,
        values[1] as B,
        values[2] as C,
        values[3] as D,
        values[4] as E,
        values[5] as F,
        values[6] as G,
        values[7] as H,
      );
    },
  );
}