groupBy<K> method

Map<K, List<V>> groupBy<K>(
  1. K keyOf(
    1. V value
    )
)

Implementation

Map<K, List<V>> groupBy<K>(K keyOf(V value)) {
  final result = <K, List<V>>{};
  for (final item in this.orEmpty()) {
    result.putIfAbsent(keyOf(item), () => <V>[]).add(item);
  }
  return result;
}