getOrSetDefault<V> method
Gets key
value. If absent sets the key value to defaultValue
and returns it.
Implementation
V? getOrSetDefault<V>(String key, V? defaultValue) {
if (!_properties.containsKey(key)) {
_properties[key] = defaultValue;
_notifyChange(StateOperation.set, key, defaultValue);
return defaultValue;
} else {
return _properties[key] as V?;
}
}