removeChild method Null safety

  1. @override
void removeChild(
  1. RenderBox child
)
override

Removes the child element corresponding with the given RenderBox.

Implementation

@override
void removeChild(RenderBox child) {
  final int index = renderObject.indexOf(child);
  owner!.buildScope(this, () {
    assert(_childElements.containsKey(index));
    final Element? result = updateChild(_childElements[index], null, index);
    assert(result == null);
    _childElements.remove(index);
    assert(!_childElements.containsKey(index));
  });
}