clearRootRenderObject method

void clearRootRenderObject(
  1. RenderObjectWithSingleChild root
)

Clear the attached root render object without disposing render resources.

Implementation

void clearRootRenderObject(RenderObjectWithSingleChild root) {
  if (!identical(_rootRenderObject, root)) {
    return;
  }
  final failures = FirstErrorRecorder();
  try {
    failures.attempt(() => root.setChild(null));
    failures.attempt((root as RenderObject).detach);
  } finally {
    _rootRenderObject = null;
    _pointerRouter.root = null;
  }
  failures.rethrowFirst();
}