Skip to content

National phone number seems to not be correctly formatted #84

@geosebas

Description

@geosebas

Hello,

I'm French so I will only talk about french number here but when I try to get a formatted national number, I don't get the correct format.

Here an example :

    final parsedPhone = PhoneNumber.parse('+33611223344', callerCountry: IsoCode.FR, destinationCountry: IsoCode.FR);
    debugPrint('nsn : ${parsedPhone.nsn}'); // print 611223344
    debugPrint('international : ${parsedPhone.international}'); // print +33611223344
    debugPrint('countryCode : ${parsedPhone.countryCode}'); // print 33
    debugPrint('national nsn formatted : ${parsedPhone.formatNsn(format: NsnFormat.national)}'); // print 6 11 22 33 44
    debugPrint('international nsn formatted : ${parsedPhone.formatNsn(format: NsnFormat.international)}'); // print 6 11 22 33 44

My problem here is that I should have a function that allow me to display a formatted national number like :

final nsn = '06 11 22 33 44' // that how a french formatted national number should look 

For french number, the country code '+33' is replaced by a '0'.

Do you have any solution for this problem ?

Edit :
I don't know if it's a bug related to your metadata, of it's by design that you want to display the number like that.
If it's by design, do you think we have a way to implement a method to the parser that will allow that ?
Edit 2 :
I tested for belgium phone number and I got the same problem.
I specify that I'm talking only about mobile phone number here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions