5
5
import 'package:args/args.dart' ;
6
6
import 'package:meta/meta.dart' ;
7
7
import 'package:package_config/package_config.dart' ;
8
- import 'package:process/process.dart' ;
9
8
10
- import '../artifacts.dart' ;
11
9
import '../base/common.dart' ;
12
10
import '../base/deferred_component.dart' ;
13
11
import '../base/file_system.dart' ;
@@ -26,8 +24,6 @@ import '../linux/build_linux.dart';
26
24
import '../macos/build_macos.dart' ;
27
25
import '../project.dart' ;
28
26
import '../runner/flutter_command.dart' ;
29
- import '../runner/flutter_command_runner.dart' ;
30
- import '../widget_preview/dtd_services.dart' ;
31
27
import '../widget_preview/preview_code_generator.dart' ;
32
28
import '../widget_preview/preview_detector.dart' ;
33
29
import '../widget_preview/preview_manifest.dart' ;
@@ -45,8 +41,6 @@ class WidgetPreviewCommand extends FlutterCommand {
45
41
required Platform platform,
46
42
required ShutdownHooks shutdownHooks,
47
43
required OperatingSystemUtils os,
48
- required ProcessManager processManager,
49
- required Artifacts artifacts,
50
44
}) {
51
45
addSubcommand (
52
46
WidgetPreviewStartCommand (
@@ -58,8 +52,6 @@ class WidgetPreviewCommand extends FlutterCommand {
58
52
platform: platform,
59
53
shutdownHooks: shutdownHooks,
60
54
os: os,
61
- processManager: processManager,
62
- artifacts: artifacts,
63
55
),
64
56
);
65
57
addSubcommand (
@@ -126,8 +118,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
126
118
required this .platform,
127
119
required this .shutdownHooks,
128
120
required this .os,
129
- required this .processManager,
130
- required this .artifacts,
131
121
}) {
132
122
addPubOptions ();
133
123
argParser
@@ -162,9 +152,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
162
152
static const String kHeadlessWeb = 'headless-web' ;
163
153
static const String kWidgetPreviewScaffoldOutputDir = 'scaffold-output-dir' ;
164
154
165
- /// Environment variable used to pass the DTD URI to the widget preview scaffold.
166
- static const String kWidgetPreviewDtdUriEnvVar = 'WIDGET_PREVIEW_DTD_URI' ;
167
-
168
155
@override
169
156
Future <Set <DevelopmentArtifact >> get requiredArtifacts async => const < DevelopmentArtifact > {
170
157
// Ensure the Flutter Web SDK is installed.
@@ -198,10 +185,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
198
185
199
186
final OperatingSystemUtils os;
200
187
201
- final ProcessManager processManager;
202
-
203
- final Artifacts artifacts;
204
-
205
188
late final FlutterProject rootProject = getRootProject ();
206
189
207
190
late final PreviewDetector _previewDetector = PreviewDetector (
@@ -220,12 +203,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
220
203
cache: cache,
221
204
);
222
205
223
- late final WidgetPreviewDtdServices _dtdService = WidgetPreviewDtdServices (
224
- logger: logger,
225
- shutdownHooks: shutdownHooks,
226
- dtdLauncher: DtdLauncher (logger: logger, artifacts: artifacts, processManager: processManager),
227
- );
228
-
229
206
/// The currently running instance of the widget preview scaffold.
230
207
AppInstance ? _widgetPreviewApp;
231
208
@@ -307,7 +284,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
307
284
shutdownHooks.addShutdownHook (() async {
308
285
await _widgetPreviewApp? .stop ();
309
286
});
310
- await configureDtd ();
311
287
_widgetPreviewApp = await runPreviewEnvironment (
312
288
widgetPreviewScaffoldProject: rootProject.widgetPreviewScaffoldProject,
313
289
);
@@ -333,31 +309,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
333
309
_populatePreviewPubspec (rootProject: rootProject);
334
310
}
335
311
336
- /// Configures the Dart Tooling Daemon connection.
337
- ///
338
- /// If --dtd-uri is provided, the existing DTD instance will be used. If the tool fails to
339
- /// connect to this URI, it will start its own DTD instance.
340
- ///
341
- /// If --dtd-uri is not provided, a DTD instance managed by the tool will be started.
342
- Future <void > configureDtd () async {
343
- final String ? existingDtdUriStr = stringArg (FlutterGlobalOptions .kDtdUrl, global: true );
344
- Uri ? existingDtdUri;
345
- try {
346
- if (existingDtdUriStr != null ) {
347
- existingDtdUri = Uri .parse (existingDtdUriStr);
348
- }
349
- } on FormatException {
350
- logger.printWarning ('Failed to parse value of --dtd-uri: $existingDtdUriStr .' );
351
- }
352
- if (existingDtdUri == null ) {
353
- logger.printTrace ('Launching a fresh DTD instance...' );
354
- await _dtdService.launchAndConnect ();
355
- } else {
356
- logger.printTrace ('Connecting to existing DTD instance at: $existingDtdUri ...' );
357
- await _dtdService.connect (dtdWsUri: existingDtdUri);
358
- }
359
- }
360
-
361
312
/// Builds the application binary for the widget preview scaffold the first
362
313
/// time the widget preview command is run.
363
314
///
@@ -506,12 +457,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
506
457
BuildMode .debug,
507
458
null ,
508
459
treeShakeIcons: false ,
509
- // Provide the DTD connection information directly to the preview scaffold.
510
- // This could, in theory, be provided via a follow up call to a service extension
511
- // registered by the preview scaffold, but there's some uncertainty around how service
512
- // extensions will work with Flutter web embedded in VSCode without a Chrome debugger
513
- // connection.
514
- dartDefines: < String > ['$kWidgetPreviewDtdUriEnvVar =${_dtdService .dtdUri }' ],
515
460
extraFrontEndOptions:
516
461
isWeb ? < String > ['--dartdevc-canary' , '--dartdevc-module-format=ddc' ] : null ,
517
462
packageConfigPath: widgetPreviewScaffoldProject.packageConfig.path,
@@ -654,7 +599,6 @@ final class WidgetPreviewStartCommand extends WidgetPreviewSubCommandBase with C
654
599
if (offline) '--offline' ,
655
600
'--directory' ,
656
601
widgetPreviewScaffoldProject.directory.path,
657
- 'dtd' ,
658
602
'flutter_lints' ,
659
603
'stack_trace' ,
660
604
],
0 commit comments