diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index fa8f42c55e..450b9a0081 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -221,8 +221,10 @@ class KernelCompiler { if (incrementalCompilerByteStorePath != null) { command.add('--incremental'); } + Uri mainUri; if (packagesPath != null) { command.addAll(['--packages', packagesPath]); + mainUri = _PackageUriMapper.findUri(mainPath, packagesPath); } if (outputFilePath != null) { command.addAll(['--output-dill', outputFilePath]); @@ -242,11 +244,6 @@ class KernelCompiler { if (extraFrontEndOptions != null) command.addAll(extraFrontEndOptions); - Uri mainUri; - if (packagesPath != null) { - command.addAll(['--packages', packagesPath]); - mainUri = _PackageUriMapper.findUri(mainPath, packagesPath); - } command.add(mainUri?.toString() ?? mainPath); printTrace(command.join(' '));