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

Add methods to return a sample number just from IsoCode #79

Open
hectorAguero opened this issue Dec 31, 2024 · 1 comment
Open

Add methods to return a sample number just from IsoCode #79

hectorAguero opened this issue Dec 31, 2024 · 1 comment

Comments

@hectorAguero
Copy link

Currently, the library does not provide a way to generate a sample phone number when only the IsoCode of the country is available. This creates challenges when trying to set a default number and format it.

Key limitations:

  • Unable to access the phoneLength (minimum/maximum) for the country.
  • Cannot retrieve the leadingDigits to enable the formatter.

Proposed Solution:
The library should include a way to fill a sample phoneNumber, using the max/min phoneLength and the leadingDigits

  • An extension on IsoCode
  • A factory constructor in PhoneNumber
PhoneNumber.fromIsoCode(IsoCode.US);
@cedvdb
Copy link
Owner

cedvdb commented Dec 31, 2024

What about :

PhoneNumber.example(isoCode: IsoCode.US, type: PhoneNumberType.mobile);

The examples are located here if you are up to implement this https://github.com/cedvdb/phone_numbers_parser/blob/main/lib/src/metadata/generated/metadata_examples_by_iso_code.dart

It should be a matter of getting the appropriate data in the map. Not sure about the cases where an example does not exists.

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