I want to avoid users entering +91 country code while registering in the flutter App using firebase Sign In with Phone Provider

Viewed 64

I want to avoid users entering +91 country code while registering in the flutter App using firebase Sign In with Phone Provider.

In my App Users are forced to enter their country code for ex +91 with mobile number during signup or registration process. I am using firebase for flutter. Now I want to fix the country code to +91 and users have to just enter their phone number. Please guide.

My code is as follows:

TextFieldWidget(
  labelText: "Mobile Number".tr,
   hintText: "Enter Your  Mobile Number with  +91 ".tr,
  initialValue: controller.currentUser?.value?.phoneNumber,
  keyboardType: TextInputType.phone,
                        onSaved: (input) => controller.currentUser.value.phoneNumber = input,
 iconData: Icons.phone_android_outlined,
      validator: (input) {
     if (input.length < 10  || input.length >10 ) {
  return 'Should be valid 10 digit mobile number';
                          }
                          return null;
                        },
                        isLast: false,
                        isFirst: false,
                      ),
1 Answers

Try this code:

TextFormField(
  inputFormatters: [
    FilteringTextInputFormatter.deny(RegExp(r'[+]')),
  ],
)
Related