combine2<T, A, B> static method

FlowState<T> combine2<T, A, B>(
  1. FlowState<A> one,
  2. FlowState<B> two, [
  3. T combiner(
    1. A a,
    2. B b
    )?
])

Implementation

static FlowState<T> combine2<T, A, B>(
  FlowState<A> one,
  FlowState<B> two, [
  T Function(A a, B b)? combiner,
]) {
  combiner ??= (a, b) => [a, b] as T;
  final combinedStream = Rx.combineLatest2<A, B, T>(one.stream, two.stream, combiner);
  final initialCombinedValue = combiner(one.current, two.current);
  return FlowState<T>(initialCombinedValue).._subject.addStream(combinedStream);
}