flutter / flutter/flutter

Android Autofill does not provide suggestions for addressCity or countryName

Open
#190,349 3 comments 0 reactions 1 assignee Claimed by @camsim99 View on GitHub
a: text input d: api docs found in release: 3.44 framework P2 platform-android team-text-input triaged-text-input
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Enable Google Autofill on an Android device.
2. Ensure a postal address is saved in the user's Google account.
3. Run the sample application below.
4. Tap the **Name** field: an Autofill suggestion appears.
5. Tap the **City** field: no suggestion appears.
6. Tap the **Country** field: no suggestion appears.
7. Replace `AutofillHints.countryName` (or `addressCity`) with `AutofillHints.postalAddress`.
8. Run the application again.
9. Tap the modified field: Android immediately offers the saved postal address.

### Expected results

The Autofill service should offer suggestions for:
- Name
- City
- Country
using the corresponding Autofill hints.

### Actual results

`AutofillHints.name` works correctly.
`AutofillHints.addressCity` never produces an Autofill suggestion.
`AutofillHints.countryName` never produces an Autofill suggestion.

However, replacing either field with:
```dart
autofillHints: const [AutofillHints.postalAddress]
```

immediately causes Android to offer the saved postal address.

This demonstrates that:
- Autofill is enabled and functioning.
- Flutter successfully communicates with the Android Autofill framework.
- The Autofill provider recognizes `postalAddress`.
- The provider (or Flutter) does not appear to recognize `addressCity` or `countryName`.

Also, in iOS the code works smoothly.

| Platform | Name | City | Country | Postal Address |

|----------|------|------|---------|----------------|

| Android | ✅ | ❌ | ❌ | ✅ |

| iOS | ✅ | ✅ | ✅ | ✅ |

### Android device

* Device: Xiaomi - 2406APNFAG
* Android: 16 (API 36)
* Autofill service: com.google.android.gms/.autofill.service.AutofillService

### Question

Is this expected Android Autofill behavior (i.e. Google Autofill does not expose city and country independently), or is there an issue in Flutter's Android Autofill implementation?

If this is an Android limitation, it might be worth documenting this behavior in the `AutofillHints` documentation, since the API suggests that `addressCity` and `countryName` are supported on Android.

### Code sample

Code sample

```dart
AutofillGroup(
child: Column(
children: [
TextFormField(
decoration: const InputDecoration(labelText: 'Name'),
autofillHints: const [AutofillHints.name],
),
TextFormField(
decoration: const InputDecoration(labelText: 'City'),
autofillHints: const [AutofillHints.addressCity],
),
TextFormField(
decoration: const InputDecoration(labelText: 'Country'),
autofillHints: const [AutofillHints.countryName],
),
],
),
);
```

### Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

### Logs

Logs

```console
[Paste your logs here]
```

### Flutter Doctor output

Doctor output

```console
[✓] Flutter (Channel stable, 3.44.8, on macOS 26.5.2 25F84 darwin-arm64, locale en-GB) [546ms]
• Flutter version 3.44.8 on channel stable at /Users/mauro/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 058e0af2c2 (8 days ago), 2026-07-23 10:56:21 -0700
• Engine revision 0cd610717b
• Dart version 3.12.2
• DevTools version 2.57.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, no-enable-swift-package-manager,
omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,401ms]
• Android SDK at /Users/mauro/Library/Android/sdk
• Emulator version 34.1.19.0 (build_id 11525734) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 26.2) [1,149ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17C52
• CocoaPods version 1.16.2

[✓] Chrome - develop for the web [4ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (4 available) [7.2s]
• 2406APNFAG (mobile) • EQBUWWGYIJ8TUS9T • android-arm64 • Android 16 (API 36)
• iPhone 17 di Mauro Mario (wireless) (mobile) • 00008150-000E35D23644401C • ios • iOS 26.5.2 23F84
• macOS (desktop) • macos • darwin-arm64 • macOS 26.5.2 25F84 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 150.0.7871.187

[✓] Network resources [212ms]
• All expected network resources are available.

• No issues found!

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.