decodeIconName static method
The name the generated enum gives the icon obj, derived from the way the
schema names it.
Icons.wb_sunny becomes wbSunny and CupertinoIcons.sun_max becomes
sunMax; an icon written as an inline IconData(0xe88a, ...) has no name
to derive from and falls back to its codepoint, as icon0xE88A. A name
that would collide with a Dart keyword gets a trailing underscore.
Implementation
static String decodeIconName(DartObject obj, int codePoint) {
final declared = obj.variable?.name;
if (declared == null) return _hexIconName(codePoint);
final name = joinIdentifierSegments(declared, lowerFirst: true);
if (name.isEmpty) return _hexIconName(codePoint);
if (RegExp('^[0-9]').hasMatch(name)) return _hexIconName(codePoint);
return _takenEnumNames.contains(name) ? '${name}_' : name;
}