createBatches method
Implementation
List<List<T>> createBatches(int batchSize) {
final int totalBatches = (length / batchSize).ceil();
return List<List<T>>.generate(totalBatches, (batchIndex) {
final int start = batchIndex * batchSize;
final int end = (start + batchSize).clamp(start, length);
return sublist(start, end);
});
}