# removeAt method

1. @override

E removeAt(

1. int index

)
override

Removes the object at position `index` from this list.

This method reduces the length of `this` by one and moves all later objects down by one position.

Returns the removed value.

The `index` must be in the range `0 ≤ index < length`. The list must be growable.

    final parts = <String>['head', 'shoulder', 'knees', 'toes'];
    final retVal = parts.removeAt(2); // knees
    print(parts); // [head, shoulder, toes]

## Implementation

    @override
    E removeAt(int index) {
      if (index < 0 || index >= _length) {
        throw RangeError.index(index, this, 'index', null, _length);
      }

      _Node<E>? current;
      if (index == 0) {
        current = _head;
        _head = _head!.next;
        _head?.prev = null;
        if (_head == null) {
          _tail = null; // List became empty
        }
      } else if (index == _length - 1) {
        current = _tail;
        _tail = _tail!.prev;
        _tail?.next = null;
      } else {
        current = _getNodeAt(index);
        current!.prev!.next = current.next;
        current.next!.prev = current.prev;
      }
      _length--;
      return current!.value;
    }