Creates a Map instance associating the given keys to values.
The created map is a LinkedHashMap.
A LinkedHashMap
requires the keys to implement compatible
operator==
and hashCode
, and it allows null as a key.
It iterates in key insertion order.
This constructor iterates over keys and values and maps each element of keys to the corresponding element of values.
List<String> letters = ['b', 'c'];
List<String> words = ['bad', 'cat'];
Map<String, String> map = new Map.fromIterables(letters, words);
map['b'] + map['c']; // badcat
If keys contains the same object multiple times, the last occurrence overwrites the previous value.
The two Iterables must have the same length.