removeLastAndClear method

T removeLastAndClear(
  1. T empty
)

Remove the last element, and clear the underlying list with the empty value.

Implementation

T removeLastAndClear(T empty) {
  final result = removeLast();
  final index = (length + _first) % _store.length; // One past new last
  _store[index] = empty;
  return result;
}