update<T> method

  1. @protected
  2. @nonVirtual
void update<T>(
  1. StateRef<T> ref,
  2. Updater<T> updater, [
  3. Object? action
])

Updates the value of the state referenced by ref with a function which provides the current state.

An optional action can be send to track which method did the update.

Implementation

@protected
@nonVirtual
void update<T>(StateRef<T> ref, Updater<T> updater, [Object? action]) {
  scope.write(ref, updater(scope.read(ref, null)), action);
}