split method
Splits elements of this List
into chunks of size
length.
Implementation
Iterable<List<T>> split(int size) sync* {
if (size == 0) throw ArgumentError('Invalid size: $size');
for (var index = 0; index < length; index += size) {
final chunkSize = index + size;
yield sublist(index, chunkSize > length ? length : chunkSize);
}
}