Back to Articles

Intermediate

Deep Link Management in Flutter

· 7 min read

What Is a Deep Link?

A deep link is a link that, when tapped, opens your app directly (and a specific screen within it) instead of a browser. A 'View Your Order' link in an email, a password reset link in an SMS, or a product link a friend shared — all of these are deep links. A well-built deep link system takes the user straight to the destination, without forcing them to open the app and navigate through menus.

Two Kinds of Deep Links

• Custom URL scheme (e.g. myapp://urun/42): simple but insecure — if the app isn't installed the link does nothing or errors out, and another app could register the same scheme. • Universal Links (iOS) / App Links (Android) (e.g. https://siteniz.com/urun/42): a normal https link; it opens the app directly if installed, or falls back to the site in a browser if not. This is the recommended approach today, since it's both secure and provides a fallback in every case.

Automatic Support with go_router

If you're using go_router (see the go_router article), deep link support needs no extra setup: every GoRoute path you define is also a deep link destination. Once the platform-side (Android/iOS) configuration is done, an incoming URL is automatically mapped to the matching route.

final router = GoRouter(
  routes: [
    GoRoute(path: '/', builder: (c, s) => const AnaSayfa()),
    GoRoute(
      path: '/urun/:id',
      builder: (context, state) {
        final id = state.pathParameters['id']!;
        final kampanya = state.uri.queryParameters['ref'];
        return UrunDetaySayfasi(urunId: id, kampanyaKodu: kampanya);
      },
    ),
  ],
);

// https://siteniz.com/urun/42?ref=kampanya gelen bir deep link
// otomatik olarak /urun/42?ref=kampanya route'una eşlenir.

Platform Configuration (Briefly)

On Android, an intent-filter is added to the Activity in AndroidManifest.xml (with autoVerify="true" for App Links verification), and a /.well-known/assetlinks.json file is published on your domain. On iOS, the Associated Domains entitlement is added to Info.plist, and a /.well-known/apple-app-site-association file is published on your site. These files prove that 'the right to open this domain's links truly belongs to this app' — otherwise any app could hijack your domain's links.

Opening While the App Is Closed

If a user taps a deep link while they've never opened the app, the OS launches the app fresh and go_router determines the initial route from the incoming URL — you usually don't need to write any extra code, since GoRouter already reads the app's first route from the platform's link. If you need to manually route a deep link that arrived inside a push notification (say, opened by tapping a notification), you do that with context.go(targetPath) wherever the relevant package (like FirebaseMessaging) tells you the app was opened by that notification.

Things to Watch Out For

• For deep links pointing to an invalid or no-longer-existing resource (a deleted product, say), show the user a meaningful 'not found' page instead of a blank screen. • Always read query parameters in a null-safe way; whoever shared the link may have forgotten one. • Make sure assetlinks.json and apple-app-site-association are reachable over HTTPS with the correct content type (application/json); otherwise platform verification fails silently.

Conclusion

Prefer Universal Links/App Links for modern deep links; custom schemes are a fragile solution that only works when the app is already installed. If you're using go_router, your route definitions are already your deep link destinations; the real work is correctly publishing the domain verification files on the platform side.