willDetachRenderer method

  1. @override
void willDetachRenderer()
inherited

A render object previously associated with this Node will be / has been removed from the tree. The given RenderObject will be of the same type as returned by this object's createRenderer.

Implementation

@override
void willDetachRenderer() {
  RenderBoxModel _renderBoxModel = renderBoxModel!;

  // Remove all intersection change listeners.
  _renderBoxModel.clearIntersectionChangeListeners();

  // Remove placeholder of positioned element.
  RenderPositionHolder? renderPositionHolder = _renderBoxModel.renderPositionHolder;
  if (renderPositionHolder != null) {
    RenderLayoutBox? parent = renderPositionHolder.parent as RenderLayoutBox?;
    if (parent != null) {
      parent.remove(renderPositionHolder);
    }
  }
}