chunk<T> function
Implementation
List<List<T>> chunk<T>(List<T> arr, int size) {
int length = (arr.length / size).ceil();
return List<List<T>>.generate(length, (int i) {
return arr.sublist(i * size, (i * size + size > arr.length) ? arr.length : i * size + size);
});
}