removeLast method

T removeLast()

Removes the last element from this mutable list.

Returns that removed element, or throws NoSuchElementException if this list is empty.

Implementation

T removeLast() {
  if (isEmpty()) {
    throw const NoSuchElementException('List is empty.');
  }
  return removeAt(lastIndex);
}