combine4<T, A, B, C, D> static method

FlowState<T> combine4<T, A, B, C, D>(
  1. FlowState<A> one,
  2. FlowState<B> two,
  3. FlowState<C> three,
  4. FlowState<D> four, [
  5. T combiner(
    1. A a,
    2. B b,
    3. C c,
    4. D d,
    )?,
])

Implementation

static FlowState<T> combine4<T, A, B, C, D>(
  FlowState<A> one,
  FlowState<B> two,
  FlowState<C> three,
  FlowState<D> four, [
  T Function(A a, B b, C c, D d)? combiner,
]) {
  combiner ??= (a, b, c, d) => [a, b, c, d] as T;
  final combinedStream = Rx.combineLatest4<A, B, C, D, T>(
    one.stream,
    two.stream,
    three.stream,
    four.stream,
    combiner,
  );
  final initialCombinedValue = combiner(one.current, two.current, three.current, four.current);
  return FlowState<T>(initialCombinedValue).._subject.addStream(combinedStream);
}