简体   繁体   中英

Flutter - Get icon from name;

In the backend, icons are setup using text like "fas fa-camera" . I can split and extract the name "camera" from the icon name. How do I get the FontAwesomeIcon of the same name from the font_awesome_flutter package?


class FontAwesomeIcons{
  static const IconData camera = const IconDataBrands(0xf26e);
}

I can hardcode a list of all icon data and compare but that's my last resort right now. Is there anything I can do without doing that?

As in package description:

Icon names equal those on the official website, but are written in lower camel case. If more than one icon style is available for an icon, the style name is used as prefix, except for "regular".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM