Closed Ascenio closed 3 years ago
@Ascenio That's a great idea.
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.
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.