diff --git a/packages/flutter_tools/lib/executable.dart b/packages/flutter_tools/lib/executable.dart index 94b4f51bc6..546dc98ae7 100644 --- a/packages/flutter_tools/lib/executable.dart +++ b/packages/flutter_tools/lib/executable.dart @@ -143,7 +143,7 @@ List generateCommands({ terminal: globals.terminal, artifacts: globals.artifacts!, // new ProjectValidators should be added here for the --suggestions to run - allProjectValidators: [], + allProjectValidators: [GeneralInfoProjectValidator()], ), AssembleCommand(verboseHelp: verboseHelp, buildSystem: globals.buildSystem), AttachCommand(verboseHelp: verboseHelp), diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart index e63d2a4279..fde75ada70 100644 --- a/packages/flutter_tools/lib/src/commands/analyze.dart +++ b/packages/flutter_tools/lib/src/commands/analyze.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:meta/meta.dart'; import 'package:process/process.dart'; import '../artifacts.dart'; @@ -112,6 +113,9 @@ class AnalyzeCommand extends FlutterCommand { @override String get category => FlutterCommandCategory.project; + @visibleForTesting + List allProjectValidators() => _allProjectValidators; + @override bool get shouldRunPub { // If they're not analyzing the current project. diff --git a/packages/flutter_tools/test/general.shard/args_test.dart b/packages/flutter_tools/test/general.shard/args_test.dart index 569006bab8..4725e37d2a 100644 --- a/packages/flutter_tools/test/general.shard/args_test.dart +++ b/packages/flutter_tools/test/general.shard/args_test.dart @@ -7,6 +7,7 @@ import 'package:args/args.dart'; import 'package:args/command_runner.dart'; import 'package:flutter_tools/executable.dart' as executable; +import 'package:flutter_tools/src/commands/analyze.dart'; import 'package:flutter_tools/src/runner/flutter_command.dart'; import 'package:flutter_tools/src/runner/flutter_command_runner.dart'; @@ -23,6 +24,12 @@ void main() { verbose: true, ).forEach(runner.addCommand); verifyCommandRunner(runner); + for (final Command command in runner.commands.values) { + if(command.name == 'analyze') { + final AnalyzeCommand analyze = command as AnalyzeCommand; + expect(analyze.allProjectValidators().length, 1); + } + } })); testUsingContext('bool? safe argResults', () async {