removeAt method

E? removeAt(
  1. int index
)

Removes the element at the specified index in this bag. Does this by overwriting with the last element and then removing the last element.

Implementation

E? removeAt(int index) {
  // make copy of element to remove so it can be returned
  final o = _data[index];
  // overwrite item to remove with last element
  _data[index] = _data[--_size];
  // null last element, so gc can do its work
  _data[size] = null;

  return o;
}