modifyState<T extends State> method

void modifyState<T extends State>(
  1. T modifier(
    1. T state
    )
)

Implementation

void modifyState<T extends State>(T Function(T state) modifier) {
  try {
    _states[T] = modifier(_states[T] as T);
    _streamController.add(StatePackage<T>(_states[T] as T));
  } catch (e) {
    throw MinimalistStateError(
        "The submitted State is not known, did you supply the state to the Store?");
  }
}