connectDebugger method
Connects to the VM Service at uri
and initializes debugging.
This method will be called by sub-classes when they are ready to start a debug session and may provide a URI given by the user (in the case of attach) or from something like a vm-service-info file or Flutter app.debugPort message.
The URI protocol will be changed to ws/wss but otherwise not normalized. The caller should handle any other normalisation (such as adding /ws to the end if required).
The implementation for this method is run in try/catch and any exceptions during initialization will result in the debug adapter reporting an error to the user and shutting down.
Implementation
Future<void> connectDebugger(Uri uri) async {
try {
await _connectDebuggerImpl(uri);
} catch (error, stack) {
final message = 'Failed to connect/initialize debugger for $uri:\n'
'$error\n$stack';
logger?.call(message);
sendConsoleOutput(message);
shutdown();
}
}