windowed method
Groups the elements in the list into a list of lists, each of the same windowSize
.
Implementation
List<List<E>> windowed(int windowSize) {
final result = List<List<E>>.empty(growable: true);
for (var i = 0; i < length; i += windowSize) {
result.add(getRange(i, i + windowSize).toList());
}
return result;
}