File tree Expand file tree Collapse file tree 3 files changed +8
-18
lines changed
packages/flutter_tools/lib/src Expand file tree Collapse file tree 3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change 22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5+ import 'dart:isolate' ;
56import 'dart:typed_data' ;
67
78import 'package:package_config/package_config.dart' ;
@@ -10,6 +11,11 @@ import '../base/common.dart';
1011import '../base/file_system.dart' ;
1112import '../base/logger.dart' ;
1213
14+ /// Loads the package configuration of the current isolate.
15+ Future <PackageConfig > currentPackageConfig () async {
16+ return loadPackageConfigUri (Isolate .packageConfigSync! );
17+ }
18+
1319/// Load the package configuration from [file] or throws a [ToolExit]
1420/// if the operation would fail.
1521///
Original file line number Diff line number Diff line change @@ -1222,14 +1222,7 @@ void log(logging.LogRecord event) {
12221222
12231223Future <Directory > _loadDwdsDirectory (
12241224 FileSystem fileSystem, Logger logger) async {
1225- final String toolPackagePath =
1226- fileSystem.path.join (Cache .flutterRoot! , 'packages' , 'flutter_tools' );
1227- final String packageFilePath =
1228- fileSystem.path.join (toolPackagePath, '.dart_tool' , 'package_config.json' );
1229- final PackageConfig packageConfig = await loadPackageConfigWithLogging (
1230- fileSystem.file (packageFilePath),
1231- logger: logger,
1232- );
1225+ final PackageConfig packageConfig = await currentPackageConfig ();
12331226 return fileSystem.directory (packageConfig['dwds' ]! .packageUriRoot);
12341227}
12351228
Original file line number Diff line number Diff line change @@ -175,16 +175,7 @@ class FlutterWebPlatform extends PlatformPlugin {
175175 }) async {
176176 final shelf.Server server = await serverFactory ();
177177 if (testPackageUri == null ) {
178- final PackageConfig packageConfig = await loadPackageConfigWithLogging (
179- fileSystem.file (fileSystem.path.join (
180- Cache .flutterRoot! ,
181- 'packages' ,
182- 'flutter_tools' ,
183- '.dart_tool' ,
184- 'package_config.json' ,
185- )),
186- logger: logger,
187- );
178+ final PackageConfig packageConfig = await currentPackageConfig ();
188179 testPackageUri = packageConfig['test' ]! .packageUriRoot;
189180 }
190181 final File testDartJs = fileSystem.file (fileSystem.path.join (
You can’t perform that action at this time.
0 commit comments