intl_phone_number_input
intl_phone_number_input copied to clipboard
smartAuth integration or isNotValid editing access
Problem:
I would like to add smartAuth requestHint() method to my authentication process. But everytime I call controller.text and apply the value I received from requestHint, later, when i call formKey.currentState!.validate()
it returns that the field is not valid (the format of the input is the same as when I type if with the keyboard).
final smartAuth = SmartAuth();
final res = await smartAuth.requestHint(
isPhoneNumberIdentifierSupported: true,
isEmailAddressIdentifierSupported: false,
showCancelButton: true,
);
if (res != null) {
final PhoneNumber phone = await PhoneNumber.getRegionInfoFromPhoneNumber(res.id);
String parsableNumber = await PhoneNumber.getParsableNumber(phone);
phoneNumberController..text = parsableNumber ?? '';
}
Cause:
This issue is due to bool isNotValid = true;
(line 140 of intl_phone_number_input/lib/src/widgets/input_widget.dart (I tried to change manually this value to false in the file, I had no issue so the problem comes from here)).
This value is not accessible from the parents and can only be changed after a human interaction. Maybe you could create a custom TextInputController that have a method that can edit this value manually from parents.