Map<K, V>.fromEntries constructor

Map<K, V>.fromEntries(
  1. Iterable<MapEntry<K, V>> entries
)

Creates a new map and adds all entries.

Returns a new Map<K, V> where all entries of entries have been added in iteration order.

If multiple entries have the same key, later occurrences overwrite the value of the earlier ones.

Equivalent to the map literal:

<K, V>{for (var e in entries) e.key: e.value}

Implementation

factory Map.fromEntries(Iterable<MapEntry<K, V>> entries) =>
    <K, V>{}..addEntries(entries);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/Map/Map.fromEntries.html