groupBy<T, K> function
Groups a list of maps by a specific key.
Implementation
Map<K, List<T>> groupBy<T, K>(List<T> items, K Function(T) keyFunction) {
return items.fold<Map<K, List<T>>>({}, (Map<K, List<T>> map, T item) {
final K key = keyFunction(item);
map.putIfAbsent(key, () => []).add(item);
return map;
});
}