flutter-studio / flutter-icons

Customizable Icons for Flutter :boom:
Apache License 2.0
332 stars 123 forks source link

Requesting an icon which does not exist returns IconData Object not null #12

Closed ride4sun closed 4 years ago

ride4sun commented 4 years ago

If I request an Icon which does not exist IconData gets returned anyway with the codePoint = null. This leads to a weird flutter assert which has nothing to do with the IconData and it is hard to track. Could u please just return null or throw an exception

IconData data = MaterialIcons.getIconData(key);

2534290808 commented 4 years ago

Assertions have been added to the getIconData method

2534290808 commented 4 years ago

The 1.0.0 release refactored the API

ride4sun commented 4 years ago

It would be nice if you could indicate the new behavior here...

ride4sun commented 4 years ago

Just updated and it seems like there are only static accessors to replace getIconData(String) is gone. Is there a replacement? This is breaking all my late binding code where icons are defined by strings. The probably fixes the tree-shaking but breaks late-binding

mateusfccp commented 4 years ago

@ride4sun

I also would like to know. There are places on my source where the IconData is dinamically obtained with FontAwesome.getIconData(somevarwithiconname). Is there a way to do something similar to this in this new API?

2534290808 commented 4 years ago

Just updated and it seems like there are only static accessors to replace getIconData(String) is gone. Is there a replacement? This is breaking all my late binding code where icons are defined by strings. The probably fixes the tree-shaking but breaks late-binding

Please use the previous version 1.0.0

ride4sun commented 4 years ago

@2534290808 This does not give any new Icon updates - right?