chunk method
Splits this list into chunks of the given size.
Implementation
List<List<T>> chunk(int size) {
if (size <= 0) return [this];
final chunks = <List<T>>[];
for (var i = 0; i < length; i += size) {
chunks.add(sublist(i, min(i + size, length)));
}
return chunks;
}