removeLast method

  1. @override
T removeLast()
override

Removes and returns the last object in this list. The list must be growable and non-empty. Note, the ranges of other slices on the underlying list will not change, therefore use with care as this may shift the underlying data in other slices.

Implementation

@override
T removeLast() {
  if (isEmpty) {
    panic("Cannot remove last element from an empty slice.");
  }
  final element = _list.removeAt(_end - 1);
  _end--;
  return element;
}