You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Ascenio
changed the title
Consider swapping strings literals for Strings
Consider swapping strings for enum
Mar 31, 2021
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.The text was updated successfully, but these errors were encountered: