migrate update_icons to null safety (#84063)

This commit is contained in:
Abhishek Ghaskata
2021-06-10 02:29:03 +05:30
committed by GitHub
parent b768056b1f
commit 2da969aa9b

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
// Regenerates the material icons file.
// See https://github.com/flutter/flutter/wiki/Updating-Material-Design-Fonts-&-Icons
@@ -332,7 +330,7 @@ class _Icon {
id = tokenPair.key;
hexCodepoint = tokenPair.value;
if (id.endsWith('_outlined') && id!='insert_chart_outlined') {
if (id.endsWith('_outlined') && id != 'insert_chart_outlined') {
shortId = _replaceLast(id, '_outlined');
htmlSuffix = '-outlined';
} else if (id.endsWith('_rounded')) {
@@ -349,7 +347,7 @@ class _Icon {
flutterId = id;
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]!);
}
}
@@ -358,14 +356,14 @@ class _Icon {
static const List<String> styleSuffixes = <String>['', '_outlined', '_rounded', '_sharp'];
String id; // e.g. 5g, 5g_outlined, 5g_rounded, 5g_sharp
String shortId; // e.g. 5g
String flutterId; // e.g. five_g, five_g_outlined, five_g_rounded, five_g_sharp
String name; // e.g. five g, five g outlined, five g rounded, five g sharp
String hexCodepoint; // e.g. e547
late String id; // e.g. 5g, 5g_outlined, 5g_rounded, 5g_sharp
late String shortId; // e.g. 5g
late String flutterId; // e.g. five_g, five_g_outlined, five_g_rounded, five_g_sharp
late String name; // e.g. five g, five g outlined, five g rounded, five g sharp
late String hexCodepoint; // e.g. e547
// The suffix for the 'material-icons' HTML class.
String htmlSuffix;
late String htmlSuffix;
String get mirroredInRTL => _iconsMirroredWhenRTL.contains(shortId) ? ', matchTextDirection: true' : '';
@@ -394,9 +392,8 @@ class _Icon {
// Sort a regular icon before its variants.
if (shortId == b.shortId) {
return id.length - b.id.length;
} else {
return flutterId.compareTo(b.flutterId);
}
return flutterId.compareTo(b.flutterId);
}
String _replaceLast(String string, String toReplace) {