From eab2087a0ffe3f2b5949c219bcf3184a0dbd9423 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Fri, 28 Jul 2023 04:04:07 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Only=20format=20Dart=20files=20f?= =?UTF-8?q?or=20`gen-l10n`=20(#131232)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improves #119596. The tests remain valid, so no tests were updated in the request. This does not resolve issue #128932, it's handled by another part of the code. --- .../lib/src/localizations/gen_l10n.dart | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/flutter_tools/lib/src/localizations/gen_l10n.dart b/packages/flutter_tools/lib/src/localizations/gen_l10n.dart index 84d37b5e33..206dedbaf1 100644 --- a/packages/flutter_tools/lib/src/localizations/gen_l10n.dart +++ b/packages/flutter_tools/lib/src/localizations/gen_l10n.dart @@ -80,15 +80,11 @@ Future generateLocalizations({ throwToolExit(e.message); } - final List outputFileList = generator.outputFileList; - final File? untranslatedMessagesFile = generator.untranslatedMessagesFile; - if (options.format) { - final List formatFileList = outputFileList.toList(); - if (untranslatedMessagesFile != null) { - // Don't format the messages file using `dart format`. - formatFileList.remove(untranslatedMessagesFile.absolute.path); - } + // Only format Dart files using `dart format`. + final List formatFileList = generator.outputFileList + .where((String e) => e.endsWith('.dart')) + .toList(growable: false); if (formatFileList.isEmpty) { return generator; }