Flutter: password autofill

14,727

Solution 1

Auto-Fill is not yet supported in flutter out of the box. There are two issues i know of which are tracking this issue (although android related). You might want to subscribe/vote on those:

I fear it won't be easy to trigger this functionality via a 3rd party plugin though.

As for your question regarding secure storage: If you are using the flutter secure storage plugin which uses the keychain on iOS, it should be synced across devices via iCloud.

Solution 2

Flutter supports now autofill (password, email, username, etc.) ☑️ The merged pull request with an example: https://github.com/flutter/flutter/pull/52126

Example:

 @override
  Widget build(BuildContext context) {
    return AutofillGroup(
      child: Column(
        children: <Widget>[
          TextField(controller: username, autofillHints: [AutofillHints.username]),
          Checkbox(
            value: isNewUser,
            onChanged: (bool newValue) {
              setState(() { isNewUser = newValue; });
            },
          ),
          if (isNewUser) TextField(controller: newPassword, autofillHints: [AutofillHints.newPassword]),
          if (isNewUser) TextField(controller: repeatNewPassword, autofillHints: [AutofillHints.newPassword]),
          if (!isNewUser) TextField(controller: password, autofillHints: [AutofillHints.password]),
        ],
      ),
    );
  }

Solution 3

I had an autofill on both an email input and password input on the same page. The autofill was only showing on the password field.

I had to wrap the TextFields in an AutoFillGroup for them to show on both!

Share:
14,727
Andrea Miotto
Author by

Andrea Miotto

In love with iOS developing.

Updated on December 10, 2022

Comments

  • Andrea Miotto
    Andrea Miotto over 1 year

    I'm looking for a way to enable the autofill for a password textfield in a login form

    As a backup solution, I was thinking to save the password in the secure storage, and then, with the biometrics, recovering the same password when a new login is performing.

    But this won't cover all the autofill password experiences from iOS 12. For example the password won't be saved across multiple devices.

    Any tips?