set method

void set(
  1. String key,
  2. Object? value
)

Replaces key with value.

Implementation

void set(String key, Object? value) {
  _ensureActive();
  final normalizedKey = validateStateKey(key);
  final normalizedValue = _normalizeStateValue(value);
  if (_batchDepth > 0) {
    _writeStatePath(_values, normalizedKey, normalizedValue);
    _pendingChangedPaths.add(normalizedKey);
    return;
  }
  _applySingleStoreChange(this, normalizedKey, () {
    _writeStatePath(_values, normalizedKey, normalizedValue);
  });
}