How can I get Flutter material icon dynamically

Viewed 207

I have the name for the icon returned from the api, for example like this:

{
  "iconName": "home"
}

So i want to display it in my application:

 icon: Icon(Icons.home)

But this icon can be any from the Icons class, so I don't want to make a helper class or HashMap to handle this.

Is there anyway to do this with reflection like in Java, or some better way?

Thanks.

1 Answers

Ok for now I implemented a Map for this. If anyone need it, it can be find here.

Related