removeFirst method

T? removeFirst()

Removes and returns the oldest element, or null when the buffer is empty.

Implementation

T? removeFirst() {
  if (_len == 0) return null;
  final T? v = _data[_head];
  _head = (_head + 1) % _capacity;
  _len--;
  return v;
}