splitLast method

(T, Slice<T>)? splitLast()

Returns the last and all the rest of the elements of the slice, or null if it is empty.

Implementation

(T, Slice<T>)? splitLast() {
  if (isEmpty) {
    return null;
  }
  var element = _list[_end - 1];
  _end--;
  return (element, Slice(_list, _start, _end));
}