pushBack method

void pushBack(
  1. T value
)

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

Implementation

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