setIfAbsent<V> method

bool setIfAbsent<V>(
  1. String key,
  2. V? value
)

Sets key to value if not stored yet.

Implementation

bool setIfAbsent<V>(String key, V? value) {
  if (!_properties.containsKey(key)) {
    _properties[key] = value;
    _notifyChange(StateOperation.set, key, value);
    return true;
  } else {
    return false;
  }
}