iconData static method
Returns an IconData from the specified map.
If the map does not have an icon key that is an integer, returns null.
Otherwise, returns an IconData with the IconData.codePoint set to the
integer from the icon key, the IconData.fontFamily set to the string
from the fontFamily key, and the IconData.matchTextDirection set to
the boolean from the matchTextDirection key (defaulting to false).
For Material Design icons (those from the Icons class), the code point
can be obtained from the documentation for the icon, and the font family
is MaterialIcons. For example, Icons.chalet would correspond to
{ icon: 0xe14f, fontFamily: 'MaterialIcons' }.
When building the release build of an application that uses the RFW
package, because this method creates non-const IconData objects
dynamically, the --no-tree-shake-icons option must be used.
Implementation
static Map<String, dynamic>? iconData(IconData? icon) {
if (icon == null) return null;
return NotNullMap.from({
'icon': icon.codePoint,
'fontFamily': icon.fontFamily,
'matchTextDirection': icon.matchTextDirection
});
}