toMapList method

Map<K, List<V>> toMapList()

Grouping the results in list according to key.

Implementation

Map<K, List<V>> toMapList() {
  final map = <K, List<V>>{};
  for (var entry in this) {
    map.putIfAbsent(entry.key, () => []).add(entry.value);
  }
  return map;
}