@@ -31,6 +31,7 @@ import 'package:dwds/src/servers/extension_backend.dart';
3131import 'package:dwds/src/services/app_debug_services.dart' ;
3232import 'package:dwds/src/services/debug_service.dart' ;
3333import 'package:dwds/src/services/expression_compiler.dart' ;
34+ import 'package:dwds/src/utilities/shared.dart' ;
3435import 'package:logging/logging.dart' ;
3536import 'package:shelf/shelf.dart' ;
3637import 'package:sse/server/sse_handler.dart' ;
@@ -159,7 +160,7 @@ class DevHandler {
159160 .takeUntilGap (const Duration (milliseconds: 50 ));
160161 // We enqueue this work as we need to begin listening (`.hasNext`)
161162 // before events are received.
162- unawaited (Future .microtask (() => connection.runtime.enable ()));
163+ safeUnawaited (Future .microtask (() => connection.runtime.enable ()));
163164
164165 await for (var contextId in contextIds) {
165166 final result = await connection.sendCommand ('Runtime.evaluate' , {
@@ -175,7 +176,7 @@ class DevHandler {
175176 }
176177 }
177178 if (appTab != null ) break ;
178- unawaited (connection.close ());
179+ safeUnawaited (connection.close ());
179180 }
180181 if (appTab == null || tabConnection == null || executionContext == null ) {
181182 throw AppConnectionException (
@@ -234,7 +235,7 @@ class DevHandler {
234235 await _chromeConnection (), appConnection);
235236 appServices = await _createAppDebugServices (
236237 appConnection.request.appId, debugService);
237- unawaited (appServices.chromeProxyService.remoteDebugger.onClose.first
238+ safeUnawaited (appServices.chromeProxyService.remoteDebugger.onClose.first
238239 .whenComplete (() async {
239240 await appServices? .close ();
240241 _servicesByAppId.remove (appConnection.request.appId);
@@ -301,7 +302,7 @@ class DevHandler {
301302 }
302303 });
303304
304- unawaited (injectedConnection.sink.done.then ((_) async {
305+ safeUnawaited (injectedConnection.sink.done.then ((_) async {
305306 _injectedConnections.remove (injectedConnection);
306307 final connection = appConnection;
307308 if (connection != null ) {
@@ -533,7 +534,8 @@ class DevHandler {
533534 );
534535 final encodedUri = await debugService.encodedUri;
535536 extensionDebugger.sendEvent ('dwds.encodedUri' , encodedUri);
536- unawaited (appServices.chromeProxyService.remoteDebugger.onClose.first
537+ safeUnawaited (appServices
538+ .chromeProxyService.remoteDebugger.onClose.first
537539 .whenComplete (() async {
538540 appServices? .chromeProxyService.destroyIsolate ();
539541 await appServices? .close ();
0 commit comments