W3cubDocs

/Dart 2

HashMap<K, V>.from constructor

HashMap<K, V>.from(Map other)

Creates a HashMap that contains all key/value pairs of other.

The keys must all be instances of K and the values of V. The other map itself can have any type.

Implementation

factory HashMap.from(Map other) {
  Map<K, V> result = new HashMap<K, V>();
  other.forEach((k, v) {
    result[k] = v;
  });
  return result;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-collection/HashMap/HashMap.from.html