BuiltMap<K, V>.from constructor

BuiltMap<K, V>.from(
  1. Map map
)

Instantiates with elements from a Map.

Must be called with a generic type parameter.

Wrong: new BuiltMap.from({1: '1', 2: '2', 3: '3'}).

Right: new BuiltMap<int, String>.from({1: '1', 2: '2', 3: '3'}).

Rejects nulls. Rejects keys and values of the wrong type.

Implementation

factory BuiltMap.from(Map map) {
  return _BuiltMap<K, V>.copyAndCheckTypes(map.keys, (k) => map[k]);
}