vmServiceClosed method

FutureOr<void> vmServiceClosed({
  1. ConnectedState connectionState = const ConnectedState(false),
})

Shuts down the service manager's current vm service connection.

Implementation

FutureOr<void> vmServiceClosed({
  ConnectedState connectionState = const ConnectedState(false),
}) async {
  // This needs to be the first call in this method so that listeners get
  // the notification of app disconnect before we shut down other managers and
  // services that listeners may be assuming have an app connection.
  _connectedState.value = connectionState;

  await callLifecycleCallbacks(
    ServiceManagerLifecycle.beforeCloseVmService,
    this.service,
  );
  _closeVmServiceConnection();
  await callLifecycleCallbacks(
    ServiceManagerLifecycle.afterCloseVmService,
    this.service,
  );

  resolvedUriManager.vmServiceClosed();
  serviceExtensionManager.vmServiceClosed();
  isolateManager.handleVmServiceClosed();
  _registeredMethodsForService.clear();
  _registeredServiceNotifiers.clear();
  setDeviceBusy(false);
}