removeChild<T extends GDisplayObject> method
Removes the specified child from this container.
If the child is not a direct child of this container, null
will be
returned.
If dispose
is true
, the removed child will also be disposed.
Returns the removed child object, or null
if the child is not a direct
child of this container.
Implementation
T? removeChild<T extends GDisplayObject>(T child, [bool dispose = false]) {
if (child.$parent != this) {
return null;
}
final index = getChildIndex(child);
if (index > -1) return removeChildAt<T>(index, dispose);
throw 'Invalid child index';
}