toMap method Null safety

Map<K, V> toMap()

Transform the Iterable<MapEntry> into a map

Example:

[MapEntry("a", 1), MapEntry("b", 2)].toMap(); // {"a": 1, "b": 2}

Implementation

Map<K, V> toMap() {
  return Map.fromEntries(this);
}