swap method

void swap(
  1. int index1,
  2. int index2
)

swaps elements on index1 with index2

Implementation

void swap(int index1, int index2) {
  startTransAction();
  final temp = this[index1];
  this[index1] = this[index2];
  this[index2] = temp;
  endTransAction();
}