chainFirst<C> method

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

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

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
State<S, A> chainFirst<C>(
  covariant State<S, C> Function(A a) chain,
) =>
    flatMap((a) => chain(a).map((_) => a));