getOrNull method

V? getOrNull(
  1. K key
)

Retrieves the value for the specified key from the map. If the key does not exist, returns null.

Example:

var map = {'first': 1, 'second': 2};
print(map.getOrNull('third')); // Output: null

Implementation

V? getOrNull(K key) {
  return containsKey(key) ? this[key] : null;
}