willDetachRenderer method

  1. @override
void willDetachRenderer()
override

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() {
  super.willDetachRenderer();

  // Cancel running transition.
  renderStyle.cancelRunningTransition();

  // Cancel running animation.
  renderStyle.cancelRunningAnimation();

  RenderBoxModel? renderBoxModel = this.renderBoxModel;
  if (renderBoxModel != null) {
    // Remove all intersection change listeners.
    renderBoxModel.clearIntersectionChangeListeners();

    // Remove fixed children from root when element disposed.
    if (ownerDocument.viewport != null && renderStyle.position == CSSPositionType.fixed) {
      _removeFixedChild(renderBoxModel, ownerDocument);
    }
    // Remove renderBox.
    renderBoxModel.detachFromContainingBlock();

    // Clear pointer listener
    clearEventResponder(renderBoxModel);

    // Remove scrollable
    renderBoxModel.disposeScrollable();
    disposeScrollable();
  }
}