groupBy method
Items are in the same sublist if they meet the criteria that compares consecutive elements.
1, 2, 3, 2, 1
.groupBy((a, b) => a < b) returns
[1, 2, 3
, 2
, 1
]. In this example, items are in the same sublist
if they are less than the next one i.e. a < b.
Implementation
List<List<E>> groupBy(bool Function(dynamic a, dynamic b) groupFunction) {
return h.groupByList(groupFunction, this);
}