toBuiltMapList method

BuiltMap<K, BuiltList<V>> toBuiltMapList()

Grouping the results in list according to key.

Implementation

BuiltMap<K, BuiltList<V>> toBuiltMapList() {
  final map = <K, ListBuilder<V>>{};
  for (var entry in this) {
    map.putIfAbsent(entry.key, () => ListBuilder<V>()).add(entry.value);
  }
  return map.map((key, value) => MapEntry(key, value.build())).build();
}