Flutter autofill with keychain of iOS app wants to show the Save or update password prompt after the API request done, not on text field submission or on button tap.
I have a Flutter app with a login page.
The login page has text fields for email address and password, as well as a login API call.The credentials are are filled from the keychain..However, when the user picks credentials from the keychain and edits the password field, the API request is initiated. The Update password prompt appears; however, I want to show the Save password or Update password prompt only when the API request is complete.
ElevatedButton(
onPressed: (){
try {
await makeLogin();
TextInput.finishAutofillContext(); //--- want to save or update password after api success.
//--- OR Your Navigation----
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context){
return Panel();
})
} catch (e) {
TextInput.finishAutofillContext(shouldSave:false);
//--- dont want save or update password if api fails.
}
);
please use below code.
login method
make sure that use have not cleared your textfields. like textController.clear();
i hope it will help Answer reference.
Please also check this answer.