@@ -16,6 +16,7 @@ import 'package:http_multi_server/http_multi_server.dart';
1616import 'package:shelf/shelf.dart' ;
1717import 'package:shelf/shelf_io.dart' as shelf_io;
1818import 'package:shelf_proxy/shelf_proxy.dart' ;
19+ import 'package:devtools_server/devtools_server.dart' ;
1920
2021import '../command/configuration.dart' ;
2122import 'chrome.dart' ;
@@ -128,21 +129,26 @@ class WebDevServer {
128129 options.configuration.verbose,
129130 );
130131 }
131-
132+ var shouldServeDevTools =
133+ options.configuration.debug || options.configuration.debugExtension;
132134 dwds = await Dwds .start (
133- hostname: options.configuration.hostname,
134- assetReader: assetReader,
135- buildResults: filteredBuildResults,
136- chromeConnection: () async =>
137- (await Chrome .connectedInstance).chromeConnection,
138- loadStrategy: loadStrategy,
139- serveDevTools:
140- options.configuration.debug || options.configuration.debugExtension,
141- enableDebugExtension: options.configuration.debugExtension,
142- enableDebugging: options.configuration.debug,
143- spawnDds: ! options.configuration.disableDds,
144- expressionCompiler: ddcService,
145- );
135+ hostname: options.configuration.hostname,
136+ assetReader: assetReader,
137+ buildResults: filteredBuildResults,
138+ chromeConnection: () async =>
139+ (await Chrome .connectedInstance).chromeConnection,
140+ loadStrategy: loadStrategy,
141+ enableDebugExtension: options.configuration.debugExtension,
142+ enableDebugging: options.configuration.debug,
143+ spawnDds: ! options.configuration.disableDds,
144+ expressionCompiler: ddcService,
145+ devtoolsLauncher: shouldServeDevTools
146+ ? (String hostname) async {
147+ var server = await serveDevTools (
148+ hostname: hostname, enableStdinCommands: false );
149+ return DevTools (server.address.host, server.port, server);
150+ }
151+ : null );
146152 pipeline = pipeline.addMiddleware (dwds.middleware);
147153 cascade = cascade.add (dwds.handler);
148154 cascade = cascade.add (assetHandler);
0 commit comments