Spec-Zone.ru › Dart 2

dart:collection

HashMap<K, V>.of конструктор

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

Создаёт HashMap, содержащий все пары ключ/значение из other. Пример:

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

Реализация

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

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-collection/HashMap/HashMap.of.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API