removeLast method

  1. @override
T removeLast ()

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

@override
T removeLast() {
  T value;

  _context.conditionallyRunInAction(() {
    value = _list.removeLast();

    // Index is _list.length as it points to the index before the last element is removed
    _notifyListUpdate(_list.length, null, value == null ? null : [value]);
  }, _atom);

  return value;
}