Support launching flutter_tools from a package URI (#23476)
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index daa5075..1601610 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -183,6 +183,12 @@
try {
if (platform.script.scheme == 'data')
return '../..'; // we're running as a test
+
+ if (platform.script.scheme == 'package') {
+ final String packageConfigPath = Uri.parse(platform.packageConfig).toFilePath();
+ return fs.path.dirname(fs.path.dirname(fs.path.dirname(packageConfigPath)));
+ }
+
final String script = platform.script.toFilePath();
if (fs.path.basename(script) == kSnapshotFileName)
return fs.path.dirname(fs.path.dirname(fs.path.dirname(script)));