safeGet method
V?
safeGet(
- K key
Updates only if the key already exists. Else, do nothing.
Example:
final map = {'a': 1, 'b': 2, 'c': 3};
map.safeUpdate('b', 4);
print(map); // Output: {'a': 1, 'b': 4, 'c': 3}
Implementation
V? safeGet(K key) {
if (containsKey(key)) {
return this[key];
} else {
return null;
}
}