From 2da969aa9b18ac159afca4f97e0f489a54be0979 Mon Sep 17 00:00:00 2001 From: Abhishek Ghaskata Date: Thu, 10 Jun 2021 02:29:03 +0530 Subject: [PATCH] migrate update_icons to null safety (#84063) --- dev/tools/update_icons.dart | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dev/tools/update_icons.dart b/dev/tools/update_icons.dart index d19b9374cc..8da6612cf5 100644 --- a/dev/tools/update_icons.dart +++ b/dev/tools/update_icons.dart @@ -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 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 styleSuffixes = ['', '_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) {