Unverified Commit 2da969aa authored by Abhishek Ghaskata's avatar Abhishek Ghaskata Committed by GitHub

migrate update_icons to null safety (#84063)

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