detach method

  1. @override
void detach()
override

Mark this render object as detached from its PipelineOwner.

Typically called only from the parent's detach, and by the owner to mark the root of a tree as detached.

Subclasses with children should override this method to detach all their children after calling the inherited method, as in super.detach().

Implementation

@override
void detach() {
  _animationController
    ?..removeStatusListener(_handleAnimationStatusChange)
    ..dispose();
  _animationController = null;
  _animation
    ?..removeListener(_handleAnimationUpdate)
    ..dispose();
  _animation = null;

  _selectionBehavior?.selectionController
      ?.removeListener(_handleSelectionControllerChange);
  _markerAnimationController?.dispose();
  _markerAnimationController = null;
  _markerAnimation?.dispose();
  _markerAnimation = null;

  _dataLabelAnimationController?.dispose();
  _dataLabelAnimationController = null;
  _dataLabelAnimation?.dispose();
  _dataLabelAnimation = null;

  parent?.selectionController
    ?..removeSelectionListener(_handleSelection)
    ..removeDeselectionListener(_handleDeselection);
  super.detach();
}