'firebase_auth/invalid-phone-number in flutter?

enter image description here - I'm using phone authentication using firebase in flutter

  • When I enter the number and I'll get the otp,
  • While Entering to the otp field and verify it shows the below error in flutter

I/flutter (27587): [firebase_auth/invalid-phone-number] The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code]. [ Invalid format. ]

I was tried sevaral ways but it did't work I was given my verify phone code for firebase given below

>  await auth.verifyPhoneNumber(
>           phoneNumber: phoneNumber,
>           verificationCompleted: verificationCompleted,
>           verificationFailed: verificationFailed,
>           codeSent: codeSent,
>           timeout: const Duration(seconds: 60),
>           codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);

my verify codesin ui section

 await authCalss.verifyPhonenumber(
                                      "+91 ${phonecontroller.text}",
                                      context,
                                      setData);


Solution 1:[1]

There is no problem with the phone number +919999900000. It seems that the problem is in your configuration.

The configuration should look similar to like this:

enter image description here

Refer to this documentation: https://firebase.flutter.dev/docs/auth/phone

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kei Credo