removeChildAt method Null safety

  1. @override
void removeChildAt(
  1. int index

Removes the child DisplayObject from the specified index position in the child list of this DisplayObjectContainer.

The parent property of the removed child is set to null, and the object is garbage collected if no other references to the child exist. The index positions of any display objects above the child in the DisplayObjectContainer are decreased by 1.


void removeChildAt(int index) {
  if (index < 0 || index >= _children.length) {
    throw ArgumentError('The supplied index is out of bounds.');
  } else {
    final child = _children[index];