didUnmountRenderObject method

  1. @override
void didUnmountRenderObject(
  1. covariant RenderObject 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(covariant RenderObject renderObject) {
  // WidgetElement can be remounted to the DOM tree and trigger widget adapter updates.
  // We need to check if the widgetElement is actually disconnected before unmounting the renderWidget.
  if (!widgetElement.isConnected) {
    if (enableWebFProfileTracking) {
      WebFProfiler.instance.startTrackUICommand();
    }
    widgetElement.unmountRenderObject();
    if (enableWebFProfileTracking) {
      WebFProfiler.instance.finishTrackUICommand();
    }
  }
}