removeLast method Null safety

  1. @override
T removeLast()
override

Removes and returns the last object in this list.

The list must be growable and non-empty.

Implementation

@override
T removeLast() {
  late T value;

  _context.conditionallyRunInAction(() {
    value = _list.removeLast();
    // Index is _list.length as it points to the index before the last element is removed
    _notifyElementUpdate(_list.length, null, value,
        type: OperationType.remove);
  }, _atom);

  return value;
}