toMap<K, V> method
Implementation
Map<K, V> toMap<K, V>(K keySelector(E e), V valueTransform(E e)) {
Map<K, V> result = {};
forEach((element) {
K k = keySelector(element);
if (result.containsKey(k)) {
throw Exception("Key exist");
}
V v = valueTransform(element);
result[k] = v;
});
return result;
}