chunks method

List<T> chunks(
  1. int chunk_size
)

Implementation

List<T> chunks(int chunk_size) {
    var b_len = this.length;
    List<T> chunks = [];
    for(int i = 0; i < b_len; i += chunk_size) {
        chunks.add(this.sublist(i,min(i+chunk_size, b_len)) as T);
    }
    return chunks;
}