forked from firka/flutter
Do not check for an existing package map if a command is going to run "pub get" to update the package map (#3202)
Also remove a redundant check for the --pub option in the run command
This commit is contained in:
@@ -10,7 +10,6 @@ import 'package:path/path.dart' as path;
|
||||
import '../application_package.dart';
|
||||
import '../base/common.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../dart/pub.dart';
|
||||
import '../device.dart';
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
@@ -82,16 +81,6 @@ class RunCommand extends RunCommandBase {
|
||||
@override
|
||||
bool get requiresDevice => true;
|
||||
|
||||
@override
|
||||
Future<int> run() async {
|
||||
if (argResults['pub']) {
|
||||
int exitCode = await pubGet();
|
||||
if (exitCode != 0)
|
||||
return exitCode;
|
||||
}
|
||||
return await super.run();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<int> runInProject() async {
|
||||
bool clearLogs = argResults['clear-logs'];
|
||||
|
||||
@@ -154,10 +154,13 @@ abstract class FlutterCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
String error = PackageMap.instance.checkValid();
|
||||
if (error != null) {
|
||||
printError(error);
|
||||
return false;
|
||||
// Validate the current package map only if we will not be running "pub get" later.
|
||||
if (!(_usesPubOption && argResults['pub'])) {
|
||||
String error = PackageMap.instance.checkValid();
|
||||
if (error != null) {
|
||||
printError(error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user