shutdown method

  1. @override
  2. @nonVirtual
Future<void> shutdown()

Shuts down the debug adapter, including terminating/detaching from the debugee if required.

Implementation

@override
@nonVirtual
Future<void> shutdown() async {
  await shutdownDebugee();
  await _waitForPendingOutputEvents();
  handleSessionTerminate();

  // Delay the shutdown slightly to allow any pending responses (such as the
  // terminate response) to be sent.
  //
  // If we don't wait long enough here, the client may miss events like the
  // TerminatedEvent. Waiting too long is generally not an issue, as the
  // client can terminate the process itself once it processes the
  // TerminatedEvent.

  Future.delayed(
    Duration(milliseconds: 500),
    () => super.shutdown(),
  );
}