chainFirst<C> method

  1. @override
StateAsync<S, A> chainFirst<C>(
  1. covariant StateAsync<S, C> chain(
    1. A a
    )
)
override

Chain a request that returns another StateAsync, execute it, ignore the result, and return the same value as the current StateAsync.

Note: chainFirst will not change the value of first for the state, but it will change the value of second when calling run().

Implementation

@override
StateAsync<S, A> chainFirst<C>(
  covariant StateAsync<S, C> Function(A a) chain,
) =>
    flatMap((a) => chain(a).map((_) => a));