[tool] Replace flutter format (#6946)

`flutter format` is deprecated on `master`, and prints a warning saying
to switch to `dart format` instead. This updates `format` to make that
switch.
This commit is contained in:
stuartmorgan
2023-01-11 14:11:35 -08:00
committed by GitHub
parent d6f71e464c
commit bbab349927
4 changed files with 17 additions and 13 deletions

View File

@ -191,10 +191,8 @@ class FormatCommand extends PackageCommand {
_getPathsWithExtensions(files, <String>{'.dart'});
if (dartFiles.isNotEmpty) {
print('Formatting .dart files...');
// `flutter format` doesn't require the project to actually be a Flutter
// project.
final int exitCode = await _runBatched(flutterCommand, <String>['format'],
files: dartFiles);
final int exitCode =
await _runBatched('dart', <String>['format'], files: dartFiles);
if (exitCode != 0) {
printError('Failed to format Dart files: exit code $exitCode.');
throw ToolExit(_exitFlutterFormatFailed);