didUnmountRenderObject method Null safety

  1. @override
void didUnmountRenderObject(
  1. covariant RenderCustomPaint renderObject
)
override

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

Implementation

@override
void didUnmountRenderObject(RenderCustomPaint renderObject) {
  renderObject
    ..painter = null
    ..foregroundPainter = null;
}