removeLast method

E removeLast ()
override

Pops and returns the last object in this list.

The list must not be empty.

Throws an UnsupportedError if this is a fixed-length list.

Implementation

E removeLast() {
  if (length == 0) {
    throw IterableElementError.noElement();
  }
  E result = this[length - 1];
  length--;
  return result;
}