flatMap<C> method

  1. @override
StateAsync<S, C> flatMap<C>(
  1. covariant StateAsync<S, C> f(
    1. A a
    )
)
override

Used to chain multiple functions that return a StateAsync.

Implementation

@override
StateAsync<S, C> flatMap<C>(covariant StateAsync<S, C> Function(A a) f) =>
    StateAsync((state) async {
      final tuple = await run(state);
      return f(tuple.$1).run(tuple.$2);
    });