diff --git a/dwds/lib/dart_web_debug_service.dart b/dwds/lib/dart_web_debug_service.dart index 4d4aee11d..45aedc6df 100644 --- a/dwds/lib/dart_web_debug_service.dart +++ b/dwds/lib/dart_web_debug_service.dart @@ -131,8 +131,6 @@ class Dwds { debugSettings.launchDevToolsInNewWindow, ); - _maybeEmitDwdsLaunchEvent(toolConfiguration); - return Dwds._( injected.middleware, devTools, @@ -142,18 +140,6 @@ class Dwds { ); } - static void _maybeEmitDwdsLaunchEvent(ToolConfiguration toolConfiguration) { - if (toolConfiguration.appMetadata.codeRunner != null) { - emitEvent( - DwdsEvent.dwdsLaunch( - codeRunner: toolConfiguration.appMetadata.codeRunner!, - isFlutterApp: - toolConfiguration.loadStrategy.buildSettings.isFlutterApp, - ), - ); - } - } - bool shouldPauseIsolatesOnStart(String appId) => _devHandler.shouldPauseIsolatesOnStart(appId); } diff --git a/dwds/lib/src/handlers/dev_handler.dart b/dwds/lib/src/handlers/dev_handler.dart index 753f0e7de..cf3443e4f 100644 --- a/dwds/lib/src/handlers/dev_handler.dart +++ b/dwds/lib/src/handlers/dev_handler.dart @@ -525,6 +525,10 @@ class DevHandler { ');', }, ); + + // Notify that DWDS has been launched and a debug connection has been made: + _maybeEmitDwdsLaunchEvent(); + return appDebugService; } @@ -695,6 +699,18 @@ class DevHandler { ); } } + + static void _maybeEmitDwdsLaunchEvent() { + if (globalToolConfiguration.appMetadata.codeRunner != null) { + emitEvent( + DwdsEvent.dwdsLaunch( + codeRunner: globalToolConfiguration.appMetadata.codeRunner!, + isFlutterApp: + globalToolConfiguration.loadStrategy.buildSettings.isFlutterApp, + ), + ); + } + } } class AppConnectionException implements Exception {