removeChildAt method

  1. @override
void removeChildAt (int index)
override

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.

Implementation

@override
void removeChildAt(int index) {
  if (index < 0 || index >= _children.length) {
    throw new ArgumentError("The supplied index is out of bounds.");
  } else {
    DisplayObject child = _children[index];
    _clearChildParent(child);
    _children.removeAt(index);
  }
}