update method

void update(
  1. S stateUpdater(
    1. S state
    )
)

Update global state with a stateUpdater function - sometimes it's more convenient than use replace

Implementation

void update(S Function(S state) stateUpdater) => replace(stateUpdater(state));