pushFront method

void pushFront(
  1. T value
)

Adds an element to the front of the list. O(1).

Implementation

void pushFront(T value) {
  final newNode = _DoubleListNode<T>(value, null, _head);
  if (_head != null) {
    _head!.prev = newNode;
  }
  _head = newNode;
  if (_tail == null) {
    _tail = newNode;
  }
  _length++;
}