LinkedHashMap.fromIterable(Iterable iterable, {K key(element), V value(element)})

Creates a LinkedHashMap where the keys and values are computed from the iterable.

For each element of the iterable this constructor computes a key/value pair, by applying key and value respectively.

The keys of the key/value pairs do not need to be unique. The last occurrence of a key will simply overwrite any previous value.

If no values are specified for key and value the default is the identity function.

Source

factory LinkedHashMap.fromIterable(Iterable iterable,
    {K key(element), V value(element)}) {
  LinkedHashMap<K, V> map = new LinkedHashMap<K, V>();
  Maps._fillMapWithMappedIterable(map, iterable, key, value);
  return map;
}