From fb192625dcee54e7289ca27457b6ac7d6506f572 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Wed, 1 May 2024 16:20:54 -0700 Subject: [PATCH] Move DWDS launch event --- dwds/lib/dart_web_debug_service.dart | 14 -------------- dwds/lib/src/handlers/dev_handler.dart | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) 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 {