swap method

void swap(
  1. Vector<T> other
)

Exchanges the contents of this vector with those of other.

Implementation

void swap(Vector<T> other) {
  final temp = List<T>.from(_data);
  _data.clear();
  _data.addAll(other._data);
  other._data.clear();
  other._data.addAll(temp);
}