LinkedHashMap<K, V>.of 构造函数

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

创建一个包含 other 中所有键值对的 LinkedHashMap。示例

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}

实现

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