swapChildrenAt method Null safety

void swapChildrenAt(
  1. int index1,
  2. int index2

Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the child list.

All other child objects in the display object container remain in the same index positions.


void swapChildrenAt(int index1, int index2) {
  final child1 = getChildAt(index1);
  final child2 = getChildAt(index2);
  _children[index1] = child2;
  _children[index2] = child1;