associate<K, V> method
Associates each element of this iterable into a Map by applying
transform to produce a MapEntry.
['alice', 'bob'].associate((s) => MapEntry(s, s.length));
// {'alice': 5, 'bob': 3}
Implementation
Map<K, V> associate<K, V>(MapEntry<K, V> Function(T) transform) {
final result = <K, V>{};
for (final element in this) {
final entry = transform(element);
result[entry.key] = entry.value;
}
return result;
}