lastChunk method

Arr<T>? lastChunk(
  1. int n
)

Return an array with the last N items in the slice. If the slice is not at least N in length, this will return null.

Implementation

Arr<T>? lastChunk(int n) {
  if (n > len()) {
    return null;
  }
  return Arr.generate(n, (index) => _list[_end - n + index]);
}