[Fonts] Fix update_icons double newline bug (#78317)

This commit is contained in:
Pierre-Louis
2021-03-16 18:03:03 +01:00
committed by GitHub
parent db37499e9b
commit 961fdeebb8

View File

@@ -36,7 +36,7 @@ const Map<String, List<String>> _platformAdaptiveIdentifiers = <String, List<Str
};
// Rewrite certain Flutter IDs (reserved keywords, numbers) using prefix matching.
const Map<String, String> _identifierRewrites = <String, String>{
const Map<String, String> identifierRewrites = <String, String>{
'1x': 'one_x',
'360': 'threesixty',
'2d': 'twod',
@@ -202,7 +202,7 @@ void main(List<String> args) {
final String newIconData = regenerateIconsFile(iconClassFileData, newTokenPairMap);
if (argResults[_dryRunOption] as bool) {
stdout.writeln(newIconData);
stdout.write(newIconData);
} else {
stderr.writeln('\nWriting to ${iconClassFile.path}.');
iconClassFile.writeAsStringSync(newIconData);
@@ -348,9 +348,9 @@ class _Icon {
}
flutterId = id;
for (final MapEntry<String, String> rewritePair in _identifierRewrites.entries) {
for (final MapEntry<String, String> rewritePair in identifierRewrites.entries) {
if (id.startsWith(rewritePair.key)) {
flutterId = id.replaceFirst(rewritePair.key, _identifierRewrites[rewritePair.key]);
flutterId = id.replaceFirst(rewritePair.key, identifierRewrites[rewritePair.key]);
}
}