Skip to content

Conversation

@alexviquez
Copy link

@alexviquez alexviquez commented Feb 19, 2023

Instaed of passing just the prefix, you can pass the whole phone number to extract the ISOCode, this helps in case you just want to know the isocode and then build the PhoneNumber from string or get the dial code

Instaed of passing just the prefix, you can pass the whole phone number to extract the ISOCode, this helps in case you just want to know the isocode and then build the PhoneNumber from string
@alexviquez alexviquez changed the title Get ISO2Code from phone number Get ISO2Code from phone number string Feb 19, 2023
prefix = prefix.startsWith('+') ? prefix : '+$prefix';
var country = Countries.countryList
.firstWhereOrNull((country) => country['dial_code'] == prefix);
.firstWhereOrNull((country) => prefix.contains(country['dial_code']);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing one more bracket at the end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!, no need more brackets, what are you talking about?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the end of 111

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you are right!

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

Successfully merging this pull request may close these issues.

2 participants