Flutter Deep Links: Universal Links and Android App Links with go_router
Set up deep links in a Flutter app — iOS Universal Links, Android App Links, the well-known verification files, and routing with go_router — plus how to test them.
On this page
Deep links open a specific screen in your app from a URL: a shared product, a password-reset email, a push notification, a marketing campaign. Done right, https://yourapp.com/product/42 opens the app on that product if installed, and your website if not.
With Firebase Dynamic Links shut down, most teams now use the platforms' own Universal Links (iOS) and App Links (Android) directly. Here's the full setup in Flutter.
##How verified links work
Both platforms verify that you own the domain before your app is allowed to open its links:
- iOS downloads
https://yourdomain.com/.well-known/apple-app-site-association - Android downloads
https://yourdomain.com/.well-known/assetlinks.json
If the files are missing or wrong, links silently open in the browser instead. That's where most setups fail.
##1. Define routes with go_router
final router = GoRouter(
routes: [
GoRoute(path: '/', builder: (_, __) => const HomeScreen()),
GoRoute(
path: '/product/:id',
builder: (_, state) =>
ProductScreen(id: state.pathParameters['id']!),
),
],
);
// MaterialApp.router(routerConfig: router)Flutter passes incoming deep links to the router, so the same paths work for links and in-app navigation. In recent Flutter versions, Flutter's built-in deep link handling is enabled by default; on older versions you enable it with a flag in Info.plist and AndroidManifest.xml (see the Flutter deep linking docs for your version).
##2. iOS: Universal Links
In Xcode, add the Associated Domains capability to the Runner target with:
applinks:yourdomain.comOn your website, serve this JSON (no file extension, over HTTPS, without redirects) at /.well-known/apple-app-site-association:
{
"applinks": {
"details": [
{
"appIDs": ["TEAMID.com.yourcompany.app"],
"components": [{ "/": "/product/*" }]
}
]
}
}Replace TEAMID with your Apple Developer Team ID and use your exact bundle ID.
##3. Android: App Links
In `android/app/src/main/AndroidManifest.xml`, inside the main activity:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="yourdomain.com" />
</intent-filter>On your website, serve /.well-known/assetlinks.json:
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.yourcompany.app",
"sha256_cert_fingerprints": ["AB:CD:..."]
}
}
]Use the SHA-256 fingerprint of the key that signs the app users install. With Play App Signing, that's the app signing key shown in Play Console (under App integrity), not just your local upload key — include both if you test locally-signed builds.
##4. Test the links
Android:
adb shell am start -a android.intent.action.VIEW \
-d "https://yourdomain.com/product/42"You can check verification status with adb shell pm get-app-links com.yourcompany.app.
iOS: paste the link into Notes or Messages on a device and tap it — typing it into Safari's address bar does not trigger Universal Links. On the simulator you can use xcrun simctl openurl booted "https://yourdomain.com/product/42".
##Troubleshooting
- Link opens the browser: check the well-known file is reachable over HTTPS, returns JSON, and has no redirect.
- iOS changes don't apply: Apple caches the association file via its CDN; reinstall the app and allow some time.
- Android verification fails: wrong SHA-256 fingerprint is the usual culprit.
- App opens but on the home screen: the path doesn't match any go_router route.
##Deferred deep links
Standard links can't remember where a user was going if the app wasn't installed yet ("deferred deep linking"). For that — common in referral and campaign flows — you need a third-party attribution or linking service, or your own server-side matching.
Pair deep links with push notifications so every notification opens the right screen.
##Frequently asked questions
What replaced Firebase Dynamic Links?+
Firebase Dynamic Links has been shut down. Most apps now use iOS Universal Links and Android App Links directly, plus a third-party linking service if they need deferred deep linking or click analytics.
Do I need a website for deep links?+
For verified https links, yes — you need a domain where you can host the two well-known files. Custom URL schemes like myapp:// don't need a domain but are less secure and don't fall back to the web.
Why does my Universal Link open Safari instead of my app?+
Usually the apple-app-site-association file is missing, served with a redirect, or doesn't list the right Team ID and bundle ID. Links typed directly into Safari's address bar also don't open apps.