toMap<K, V> function
Returns a Map with keys that's generated by generator.
Implementation
Map<K, V> toMap<K, V>(List<V> list, GeneratorKey<V, K> generatorKey) {
return Map<K, V>.fromIterables(list.map(generatorKey), list);
}