detachRenderBox static method
Implementation
static void detachRenderBox(RenderObject renderBox) {
if (renderBox.parent == null) return;
// Remove reference from parent.
RenderObject? parentRenderObject = renderBox.parent as RenderObject;
if (parentRenderObject is RenderObjectWithChildMixin) {
parentRenderObject.child = null; // Case for single child, eg. RenderViewportBox.
} else if (parentRenderObject is ContainerRenderObjectMixin) {
parentRenderObject.remove(renderBox); // Case for multi children, eg. RenderLayoutBox or RenderSliverList.
}
}