mergeMap<K, V> function

Map<K, V> mergeMap<K, V>(
  1. Iterable<Map<K, V>?> maps, {
  2. bool recursive = true,
  3. bool acceptNull = false,
})

Merges the values of the given maps together.

recursive is set to true by default. If set to true, then nested maps will also be merged. Otherwise, nested maps will overwrite others.

acceptNull is set to false by default. If set to false, then if the value on a map is null, it will be ignored, and that null will not be copied.

Implementation

Map<K, V> mergeMap<K, V>(Iterable<Map<K, V>?> maps,
    {bool recursive = true, bool acceptNull = false}) {
  final result = <K, V>{};
  // ignore: avoid_function_literals_in_foreach_calls
  maps.forEach((map) {
    if (map != null) _copyValues(map, result, recursive, acceptNull);
  });
  return result;
}