groupBy function

Map groupBy(
  1. List list,
  2. dynamic iteratee
)

Implementation

Map<dynamic, dynamic> groupBy(List list, dynamic iteratee) {
  return reduce(list, (Map<dynamic, dynamic> result, dynamic value, int index) {
    final key = evaluatePredicateKey(iteratee, value);
    result[key] = result[key] == null ? [value] : [...result[key], value];
    return result;
  }, {});
}