popFront method

void popFront()

Removes the first element from the list. Throws a StateError if the list is empty.

Implementation

void popFront() {
  if (_head == null) {
    throw StateError('Cannot pop from an empty ForwardList');
  }
  _head = _head!.next;
  _length--;
}