mapAddValue<K, V> static method

void mapAddValue<K, V>(
  1. Map<K, List<V>> map,
  2. K key,
  3. V value
)

Adds a value to a map of lists.

Implementation

static void mapAddValue<K, V>(Map<K, List<V>> map, K key, V value) {
  if (value == null) return;
  // ignore: require_future_error_handling
  map.update(key, (List<V> list) => list..add(value), ifAbsent: () => <V>[value]);
}