groupSetsBy<K> method
Groups elements into sets by keyOf
.
Implementation
Map<K, Set<T>> groupSetsBy<K>(K Function(T element) keyOf) {
var result = <K, Set<T>>{};
for (var element in this) {
(result[keyOf(element)] ??= <T>{}).add(element);
}
return result;
}