groupListsBy<K> method
Null safety
- K keyOf(
- T element
Groups elements into lists by keyOf
.
Implementation
Map<K, List<T>> groupListsBy<K>(K Function(T element) keyOf) {
var result = <K, List<T>>{};
for (var element in this) {
(result[keyOf(element)] ??= []).add(element);
}
return result;
}