write<T> method
Updates the value of the state referenced by ref
with state
.
An optional action
can be send to track which method did the update.
Implementation
@override
void write<T>(StateRef<T> ref, T state, [Object? action]) {
onWrite?.call(ref, state, action);
final T oldState =
_states.containsKey(ref.key) ? _states[ref.key] as T : ref.initialState;
_states[ref.key] = state;
_mementoObserver.didChanged(ref, oldState, state, action);
}