loadOrDefault<K, V> function

V loadOrDefault<K, V>(
  1. Map<K, V> map,
  2. K key,
  3. V value
)

Implementation

V loadOrDefault<K, V>(Map<K, V> map, K key, V value) {
  final read = map[key];
  if (read == null) {
    map[key] = value;
    return value;
  }
  return read;
}