modify method

StateAsync<S, Unit> modify(
  1. S f(
    1. S state
    )
)

Change the current state S using f and return nothing (Unit).

Implementation

StateAsync<S, Unit> modify(S Function(S state) f) =>
    StateAsync((state) async => (unit, f(state)));