LunaGao / flag_flutter

flag icons
https://pub.dev/packages/flag
BSD 2-Clause "Simplified" License
63 stars 60 forks source link

Consider swapping strings for enum #50

Closed Ascenio closed 3 years ago

Ascenio commented 3 years ago

So, I think enums are just safer because we are in a typed language so makes sense to use it. You could keep strings as is and mark them as deprecated so that in near future they can be removed without breaking changes. For those who still prefer literals you could provide a Flag.fromString, but it wouldn't harm to get rid of the strings, but that's just my opinion. Would like to know what you guys think.

LunaGao commented 3 years ago

@Ascenio That's a great idea.

bounty1342 commented 3 years ago

Flag.fromString would be much needed in that case. If countryCode is the result of an API, there is no way to make sure there is a corresponding flag, making also the replacementWidget obsolete.