destroyInstance method

void destroyInstance(
  1. RootWidgetViewModel? rootWidget
)

Implementation

void destroyInstance(RootWidgetViewModel? rootWidget) {
  if (rootWidget == null) {
    return;
  }
  rootWidget.onResumeAndPauseListener = null;
  _devSupportManager.detachFromHost(rootWidget);

  _engineContext?.bridgeManager.unloadInstance(rootWidget.id);
  var listeners = engineContext?.instanceLifecycleEventListener;
  listeners?.forEach((element) {
    element.onInstanceDestroy(rootWidget.id);
  });
  engineContext?.renderContext.destroyRootView(id, false);
  rootWidget.destroy();
}