Flutter String to Icon value
As pointed out by @user3705905 and as mentioned in https://github.com/flutter/flutter/issues/75633 using the hexadecimal or IconData.codePoint
value won't work any more. In order to overcome the issue and to store references of the icon's IconData
you can use below solution using map (for example):
Map<String, IconData> iconsMap = {
'add_shopping_cart': Icons.add_shopping_cart,
'calendar_view_week_rounded': Icons.calendar_view_day_rounded,
'call_end_outlined': Icons.call_end_outlined,
'call_made': Icons.call_made,
};
Later you can simple use the map key in and later get the Icons data.
You can do it by using Icon class constants according to official Flutter docs.
Icon(IconData(61668, fontFamily: 'MaterialIcons'));
Check more Icon class constants here: https://api.flutter.dev/flutter/material/Icons-class.html#constants
you can use Icon class constants according to official Flutter docs. (https://api.flutter.dev/flutter/material/Icons-class.html#constants)
example:IconData(0xf518, fontFamily: 'MaterialIcons')
also you can generate custom images to font icon (Generate to font). save ttf file in assets. pass unicode data (like "e90a").
example:
Icon(IconData(int.parse('0x${e90a}',
fontFamily: 'family name given in the link above'));