by method
Splits this iterable into lists of the given size
.
Contract
Throws a RangeError if size <= 0
.
Example
[1, 2, 3, 4, 5].split.by(size: 2); // [[1, 2], [3, 4], [5]]
Implementation
@Possible({RangeError})
@lazy @useResult Iterable<List<E>> by({required int size}) => window(size: size, by: size, partial: true);