associate<K, V> method
Returns a Map containing key-value pairs provided by transform
function
applied to elements of this collection.
If any of two pairs would have the same key the last one gets added to the map.
Implementation
Map<K, V> associate<K, V>(MapEntry<K, V> Function(E element) transform) {
final map = <K, V>{};
for (final element in this) {
final entry = transform(element);
map[entry.key] = entry.value;
}
return map;
}