Handling Deep Links End To End On Android And iOS
Summary
Summary
Summary
Summary

This tutorial explains end-to-end deep linking for flutter mobile development: choose between App Links/Universal Links and custom schemes, configure AndroidManifest and iOS entitlements, host assetlinks.json and apple-app-site-association correctly, and handle links in Flutter using getInitialUri and uriLinkStream. Test with adb and simctl and prefer https-based links for security.

This tutorial explains end-to-end deep linking for flutter mobile development: choose between App Links/Universal Links and custom schemes, configure AndroidManifest and iOS entitlements, host assetlinks.json and apple-app-site-association correctly, and handle links in Flutter using getInitialUri and uriLinkStream. Test with adb and simctl and prefer https-based links for security.

This tutorial explains end-to-end deep linking for flutter mobile development: choose between App Links/Universal Links and custom schemes, configure AndroidManifest and iOS entitlements, host assetlinks.json and apple-app-site-association correctly, and handle links in Flutter using getInitialUri and uriLinkStream. Test with adb and simctl and prefer https-based links for security.

This tutorial explains end-to-end deep linking for flutter mobile development: choose between App Links/Universal Links and custom schemes, configure AndroidManifest and iOS entitlements, host assetlinks.json and apple-app-site-association correctly, and handle links in Flutter using getInitialUri and uriLinkStream. Test with adb and simctl and prefer https-based links for security.

Key insights:
Key insights:
Key insights:
Key insights:
  • Understanding Deep Links: Prefer https-based App Links/Universal Links for security and seamless UX; plan host and path patterns and host verification files.

  • Configuring Android: Add intent-filters with http/https, use android:autoVerify and host a matching assetlinks.json with correct SHA256 fingerprints.

  • Configuring iOS: Enable Associated Domains, add applinks:example.com in entitlements, and serve an apple-app-site-association file at the domain root with content-type application/json.

  • Handling Links In Flutter: Use uni_links to handle cold starts with getInitialUri and streaming events with uriLinkStream; parse Uri and navigate with a navigatorKey.

  • Testing And Verification: Use adb to open links on Android and xcrun simctl openurl on iOS; confirm verification files are accessible and served with correct MIME types.

Introduction

Deep links let your app open specific content from URLs or custom schemes. For Flutter mobile development, implementing deep links end to end requires configuration on Android and iOS, plus Flutter-side handling that is robust to cold starts and background events. This tutorial shows a practical, code-forward approach: App Links/Universal Links for web-hosted deep linking and custom schemes as a fallback. You will learn manifest and entitlements setup, how to listen for links in Flutter, and how to test on devices and emulators.

Understanding Deep Links

There are two common deep link types: custom URL schemes (myapp://path) and platform-managed links (Android App Links and iOS Universal Links using https). Platform-managed links are preferred because they are secure and allow opening the app without prompting when the domain is verified. For mobile development with flutter, plan your link patterns, choose host names and path prefixes, and host the verification files (assetlinks.json for Android, apple-app-site-association for iOS) at the root of the domain with correct content types.

Key goals:

  • Use https links for verified behavior.

  • Support fallback to custom schemes for older OS versions where necessary.

  • Handle both initialUri (cold start) and link stream (runtime).

Configuring Android

  1. AndroidManifest.xml: add an intent-filter inside the that launches your Flutter activity. Use scheme https, host, and pathPrefix or pathPattern. For App Links add android:autoVerify="true".

  2. Hosting: place a digital asset links file at https://yourdomain/.well-known/assetlinks.json listing your app's package name and SHA256 certificate fingerprints. The file must be served with content-type application/json.

  3. Custom scheme fallback: also declare an intent-filter for a custom scheme if you want myapp:// style links.

Example manifest fragment (conceptual):

  • intent-filter with action VIEW, categories DEFAULT and BROWSABLE, data scheme https host example.com

Verify with adb after installing:

  • adb shell am start -a android.intent.action.VIEW -d https://example.com/path com.example.yourapp

If autoVerify fails, the system will not open links automatically; ensure assetlinks.json matches exactly the app signing certificate.

Configuring iOS

  1. Associated Domains capability: enable in Xcode and add an entitlement entry under Associated Domains: applinks:example.com.

  2. Hosting: create an apple-app-site-association JSON at https://example.com/apple-app-site-association (no .json extension). Serve as application/json and include your app's appID in the applinks section.

  3. Custom URL scheme: add a URL type in Info.plist for scheme-based linking as fallback.

Notes: Universal Links open the app without asking only if the AASA file is valid and the app has the entitlement. Test with the simulator using xcrun simctl openurl.

Handling Links In Flutter

Use a dedicated package such as uni_links to manage both the initial link and the stream of incoming links. Handle three cases: cold start (getInitialUri), resume from background (getInitialUri may return non-null), and foreground link events (uriLinkStream). Always validate the Uri and route within your app.

Example initialization in main.dart:

import 'package:flutter/material.dart';
import 'package:uni_links/uni_links.dart';
<p>void main() => runApp(MyApp());</p>


Listener pattern (concise example):

// inside a State class
@override
void initState() {
  super.initState();
  _initDeepLinkHandling();
}
<p>Future<void> _initDeepLinkHandling() async {<br>final initial = await getInitialUri();<br>if (initial != null) _handleUri(initial);<br>uriLinkStream.listen((Uri? uri) { if (uri != null) _handleUri(uri); });<br>}</p>


Routing: convert the incoming Uri to a route name or directly push a page with parsed parameters. Do not assume a single entry point; check whether the navigator is ready (use a navigatorKey) and queue the deep link until Flutter finishes bootstrapping.

Testing in Flutter: use adb and simctl to open https links and observe navigation. For web-hosted links test that the verification files are reachable over HTTPS and have the right MIME type.

Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.

Conclusion

End-to-end deep linking on Android and iOS requires coordinated changes: domain-hosted verification files, platform manifest or entitlements changes, and Flutter code that handles both initial and runtime link events. Use App Links and Universal Links whenever possible for security and user experience, and fall back to custom schemes if needed. With uni_links or similar packages and careful testing via adb and simctl, you can implement reliable deep linking in your flutter mobile development projects.

Introduction

Deep links let your app open specific content from URLs or custom schemes. For Flutter mobile development, implementing deep links end to end requires configuration on Android and iOS, plus Flutter-side handling that is robust to cold starts and background events. This tutorial shows a practical, code-forward approach: App Links/Universal Links for web-hosted deep linking and custom schemes as a fallback. You will learn manifest and entitlements setup, how to listen for links in Flutter, and how to test on devices and emulators.

Understanding Deep Links

There are two common deep link types: custom URL schemes (myapp://path) and platform-managed links (Android App Links and iOS Universal Links using https). Platform-managed links are preferred because they are secure and allow opening the app without prompting when the domain is verified. For mobile development with flutter, plan your link patterns, choose host names and path prefixes, and host the verification files (assetlinks.json for Android, apple-app-site-association for iOS) at the root of the domain with correct content types.

Key goals:

  • Use https links for verified behavior.

  • Support fallback to custom schemes for older OS versions where necessary.

  • Handle both initialUri (cold start) and link stream (runtime).

Configuring Android

  1. AndroidManifest.xml: add an intent-filter inside the that launches your Flutter activity. Use scheme https, host, and pathPrefix or pathPattern. For App Links add android:autoVerify="true".

  2. Hosting: place a digital asset links file at https://yourdomain/.well-known/assetlinks.json listing your app's package name and SHA256 certificate fingerprints. The file must be served with content-type application/json.

  3. Custom scheme fallback: also declare an intent-filter for a custom scheme if you want myapp:// style links.

Example manifest fragment (conceptual):

  • intent-filter with action VIEW, categories DEFAULT and BROWSABLE, data scheme https host example.com

Verify with adb after installing:

  • adb shell am start -a android.intent.action.VIEW -d https://example.com/path com.example.yourapp

If autoVerify fails, the system will not open links automatically; ensure assetlinks.json matches exactly the app signing certificate.

Configuring iOS

  1. Associated Domains capability: enable in Xcode and add an entitlement entry under Associated Domains: applinks:example.com.

  2. Hosting: create an apple-app-site-association JSON at https://example.com/apple-app-site-association (no .json extension). Serve as application/json and include your app's appID in the applinks section.

  3. Custom URL scheme: add a URL type in Info.plist for scheme-based linking as fallback.

Notes: Universal Links open the app without asking only if the AASA file is valid and the app has the entitlement. Test with the simulator using xcrun simctl openurl.

Handling Links In Flutter

Use a dedicated package such as uni_links to manage both the initial link and the stream of incoming links. Handle three cases: cold start (getInitialUri), resume from background (getInitialUri may return non-null), and foreground link events (uriLinkStream). Always validate the Uri and route within your app.

Example initialization in main.dart:

import 'package:flutter/material.dart';
import 'package:uni_links/uni_links.dart';
<p>void main() => runApp(MyApp());</p>


Listener pattern (concise example):

// inside a State class
@override
void initState() {
  super.initState();
  _initDeepLinkHandling();
}
<p>Future<void> _initDeepLinkHandling() async {<br>final initial = await getInitialUri();<br>if (initial != null) _handleUri(initial);<br>uriLinkStream.listen((Uri? uri) { if (uri != null) _handleUri(uri); });<br>}</p>


Routing: convert the incoming Uri to a route name or directly push a page with parsed parameters. Do not assume a single entry point; check whether the navigator is ready (use a navigatorKey) and queue the deep link until Flutter finishes bootstrapping.

Testing in Flutter: use adb and simctl to open https links and observe navigation. For web-hosted links test that the verification files are reachable over HTTPS and have the right MIME type.

Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.

Conclusion

End-to-end deep linking on Android and iOS requires coordinated changes: domain-hosted verification files, platform manifest or entitlements changes, and Flutter code that handles both initial and runtime link events. Use App Links and Universal Links whenever possible for security and user experience, and fall back to custom schemes if needed. With uni_links or similar packages and careful testing via adb and simctl, you can implement reliable deep linking in your flutter mobile development projects.

Build Flutter Apps Faster with Vibe Studio

Vibe Studio is your AI-powered Flutter development companion. Skip boilerplate, build in real-time, and deploy without hassle. Start creating apps at lightning speed with zero setup.

Other Insights

Join a growing community of builders today

Join a growing community of builders today

Join a growing community of builders today

Join a growing community of builders today

Join a growing community of builders today

28-07 Jackson Ave

Walturn

New York NY 11101 United States

© Steve • All Rights Reserved 2025

28-07 Jackson Ave

Walturn

New York NY 11101 United States

© Steve • All Rights Reserved 2025

28-07 Jackson Ave

Walturn

New York NY 11101 United States

© Steve • All Rights Reserved 2025

28-07 Jackson Ave

Walturn

New York NY 11101 United States

© Steve • All Rights Reserved 2025

28-07 Jackson Ave

Walturn

New York NY 11101 United States

© Steve • All Rights Reserved 2025

28-07 Jackson Ave

Walturn

New York NY 11101 United States

© Steve • All Rights Reserved 2025