removeLast method Null safety

  1. @override
E removeLast()
override

Removes and returns the last element of the queue.

The queue must not be empty when this method is called.

Implementation

@override
E removeLast() {
  if (_head == _tail) throw StateError('No element');
  _tail = (_tail - 1) & (_table.length - 1);
  var result = _table[_tail] as E;
  _table[_tail] = null;
  return result;
}