Jagath Ratchagan
Jagath Ratchagan

Reputation: 545

Flutter: Load FontAwesome icon based on api

Getting api response like this

"sample_response": 
                {
                    "id": 1,
                    "icon": "fa-ambulance",
                }

for static icon i used

  icon: FaIcon(FontAwesomeIcons.gamepad), 

How to load icon based on the json response

Upvotes: 1

Views: 1220

Answers (1)

Thierry
Thierry

Reputation: 8393

This is not supported by Font Awesome Flutter.

There is another package to help you with that: Icons Helper

However, if you try right now, you will see that Icons Helper refers to an adobe icon that does not exist anymore. It has been removed from the package in the master on Git but not yet on PubDev.

You could also just integrate icons_helper.dart in your project and maintain the map you need in your app.

Upvotes: 2

Related Questions