modify method

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

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

Implementation

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