setValue method

void setValue(
  1. String key,
  2. dynamic value
)

Sets the value for the key on the registry. If the value is null, this redirects to removeValue.

If the value is different than the current value for the key then this will fire an event on the valueStream with the key so listeners can be notified that it has changed.

Implementation

void setValue(
  String key,
  dynamic value,
) {
  assert(key.isNotEmpty == true);
  if (value == null) {
    removeValue(key);
  } else {
    var current = _values[key];
    if (current != value) {
      _values[key] = value;
      _valueStreamController?.add(key);
    }
  }
}