detachRootComponent method

void detachRootComponent()

Detaches the current root component from the tree and disposes/unmounts it.

Implementation

void detachRootComponent() {
  if (_rootElement != null) {
    final buildOwner = _rootElement!._owner!;
    buildOwner.lockState(() {
      buildOwner._inactiveElements.add(_rootElement!);
      buildOwner._inactiveElements._unmountAll();
    });
    _rootElement = null;
  }
}