LinkedHashMap<K, V>.of constructor Null safety

LinkedHashMap<K, V>.of(
  1. Map<K, V> other
)

Creates a LinkedHashMap that contains all key value pairs of other. Example:

final baseMap = <int, String> {3: 'A', 2: 'B', 1: 'C', 4: 'D'};
final mapOf = LinkedHashMap<num, Object>.of(baseMap);
print(mapOf); // {3: A, 2: B, 1: C, 4: D}

Implementation

factory LinkedHashMap.of(Map<K, V> other) =>
    LinkedHashMap<K, V>()..addAll(other);