Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With the 5.0.0 version, it's impossible to validate phone numbers for an arbitrary country #24

Closed
Zverik opened this issue May 21, 2022 · 2 comments

Comments

@Zverik
Copy link

Zverik commented May 21, 2022

Since 5.0.0, instead of specifying a country ISO code as string, this library requires using the generated enum. This is fine when a country is known at compilation time, but for multi-national apps it breaks the workflow. All I know is a string. Even if it were a enum, it would be a different enum, coming from a different library.

Is there a way to use string ISO codes with this library?

@cedvdb
Copy link
Owner

cedvdb commented May 22, 2022

Do I understand correctly that you need to transform a string from 'US' to IsoCode.US dynamically ?

Yes, Dart enums are spawnable with a String, I'll add something to the documentation so it's clearer.

in the mean time you can use Enum.values.byName(your_string) so in this case IsoCode.values.byName('US')

@cedvdb
Copy link
Owner

cedvdb commented May 22, 2022

I've updated the readme with an example. Feel free to reopen if that's not your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants