# Flutter deep linking without Firebase: App Links, deferred links and routing

> How to set up deep links in a Flutter app now that Firebase Dynamic Links is gone. App Links and Universal Links, why Flutter's built-in deep linking must be switched off, deferred links through the Play Install Referrer, and routing with go_router.

Source: https://straitlink.in/blog/flutter-deep-linking-without-firebase/

For years, the standard answer to "how do I do deep links in Flutter?" was the `firebase_dynamic_links` plugin. Firebase Dynamic Links shut down on 25 August 2025, and Google no longer opens apps from its links: some return 404, and the ones that still redirect only reach their web or store fallback. Flutter apps that relied on it need a new path, and many teams also want to drop Firebase from the dependency tree entirely.

This post walks through Flutter deep linking without Firebase: what the platforms give you for free, what they don't, and how a link service fills the gap. The code uses the Strait Flutter package (`strait_sdk`), but the platform parts apply whatever you choose.

## What you need to replace

`firebase_dynamic_links` did four things for a Flutter app:

1. **Opened the app from a link** when it was installed (via App Links and Universal Links on a page.link domain).
2. **Kept the link through an install**, so the first open after installing landed on the right screen. That's a deferred deep link, and it's the part the platforms don't do.
3. **Served one link for every platform**: the app on Android and iPhone, a web page on a computer.
4. **Built preview cards** for chat apps from social tags.

The first point is free and built into Android and iOS. The other three need a server that sits between the tap and the store.

## Step 1: the free part, App Links and Universal Links

**Android App Links** let Android open your app directly for `https://` links on a domain you've verified. You add an intent filter with `android:autoVerify="true"` to your main activity, and the domain serves `/.well-known/assetlinks.json` listing your package name and the SHA-256 of your signing certificate. **iOS Universal Links** are the same idea: an Associated Domains entitlement (`applinks:your.domain`) plus an `apple-app-site-association` file on the domain.

With a link service, the domain is the service's, so it serves those files for you from your app settings. With Strait, that's your workspace domain, `<handle>.strait.link`. You still add the intent filter and entitlement to your app.

Check both files before you test on a phone. Our free [App Links checker](https://straitlink.in/tools/app-links-checker/) fetches them, validates the format and the SHA-256, and tells you what's wrong in plain words. The most common Android mistake is the wrong fingerprint: apps distributed through Google Play are signed by Play, so the SHA-256 that matters is the **app signing** key from Play Console, not your local debug key.

## Step 2: switch off Flutter's own deep linking

This one catches many Flutter teams. Since Flutter 3.x, the engine can handle deep links itself and push the path to your router. That sounds helpful, but it means Flutter consumes the URL before your link package sees it. A short link like `/summer` gets pushed to your router as a route that doesn't exist, instead of being resolved to its real destination.

Turn it off on both platforms:

```xml title="android/app/src/main/AndroidManifest.xml (inside <activity>)"
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
```

On iPhone, set `FlutterDeepLinkingEnabled` to `NO` in `Info.plist`. If you skip this, the symptom is exactly that: links open the app on an unknown route.

## Step 3: receive every link in one place

A link can reach your app in three situations: it launched the app from closed, it brought the app back from the background, or it was tapped before the app was installed (the deferred case). Handling each separately is where bugs creep in, so `strait_sdk` merges them into one stream.

Your app hands it the inputs. [`app_links`](https://pub.dev/packages/app_links) gives the launch link and later links, a `WidgetsBindingObserver` gives lifecycle changes, and [`play_install_referrer`](https://pub.dev/packages/play_install_referrer) gives the Android install referrer:

```dart title="links.dart (abridged)"
links = StraitLinks(
  publishableKey: 'st_pub_live_…',
  endpoint: 'https://hilltop.strait.link',
  platform: Platform.isIOS ? 'ios' : Platform.isAndroid ? 'android' : 'other',
  storage: PrefsStore(await SharedPreferences.getInstance()),
  installReferrer: () async =>
      Platform.isAndroid ? (await PlayInstallReferrer.installReferrer).installReferrer : null,
  deviceFields: () => currentDeviceFields(),
);

final appLinks = AppLinks();
await links.start(
  initialUrl: (await appLinks.getInitialLink())?.toString(),
  urls: appLinks.uriLinkStream.map((u) => u.toString()),
  lifecycle: LifecycleFeed().stream,
);
```

The key in the app is the **publishable** key (`st_pub_live_……`), which is safe to ship. Secret keys stay on your server. The full setup, including the small storage and lifecycle classes, is on the [Flutter install page](https://straitlink.in/docs/sdks/flutter/).

The package is pure Dart: no native code of its own, so there's no platform channel to debug. One detail matters for iPhone: pass the time zone as an IANA name such as `Asia/Kolkata` (from [`flutter_timezone`](https://pub.dev/packages/flutter_timezone)), because `DateTime.timeZoneName` is an abbreviation on some platforms.

## Step 4: route with go_router

Every link arrives as one event with a path and query parameters. Routing is then a single listener:

```dart title="main.dart"
Future<void> main() async {
  await startLinks();
  links.onLink.listen((e) {
    if (e.matched && e.path != null) {
      router.go(Uri(path: e.path, queryParameters: e.params).toString());
    }
  });
  runApp(MaterialApp.router(routerConfig: router));
}
```

`e.kind` tells you whether the link opened an installed app (`direct`) or was tapped before the install (`deferred`), and `e.route` how it was delivered. `onLink` replays past events to late subscribers, so subscribing after the first frame doesn't lose the launch link. If you use a navigator key instead of `go_router`, the same listener calls `navigatorKey.currentState?.pushNamed(...)`. Details: [Receive links in Flutter](https://straitlink.in/docs/sdks/flutter/receive-links/).

## Step 5: deferred links on Android, exactly

This is the part Firebase used to handle and the platforms don't. When someone without your app taps a link on Android, the link server sends them to Google Play with the link attached to the install, in the `referrer` parameter. Google Play keeps that value through the install. On first open, the package reads it through the Install Referrer API, asks the server which link it belongs to, and emits a `deferred` event with the link's path.

Because the link travels with the install itself, there is no guessing: the install is joined to the exact tap. Two things to know when testing:

- The build must be installed **from Google Play**. An internal testing track works; a build from `flutter run` or a sideloaded APK has no referrer.
- While the app isn't public, set **Dashboard → Apps & stores → People without the app → Always Google Play**, so the tap goes to the store instead of your website.

The [Flutter test page](https://straitlink.in/docs/sdks/flutter/test/) has the full checklist: uninstall, tap, install from Play, open, and check the event in Analytics.

## iPhone: what's different

iOS passes nothing through the App Store, so there's no referrer to read. Strait uses a short-lived match instead: the "Get the app" tap records a coarse device signature with the link, and the app's first open is matched to it within a short window. You choose this device matching, a paste handoff, or both in the dashboard (new workspaces start with both off), and the app picks up the choice without a release. Device matching alone never reads the clipboard, so there's no paste prompt. Universal Links were tested on a real iPhone in October 2026. Install matching is proven on iPhone simulators, and its real-iPhone run waits on our App Store listing, so plan your iPhone launch with that in mind.

## Step 6: count what happens

Every link open is reported once, automatically, and retried for up to seven days if the phone is offline. To put revenue on the tap that brought the user, record purchases:

```dart
await links.trackEvent('purchase', value: 499, currency: 'INR');
```

The event carries the tap id of the most recent link open within seven days, so a purchase shows up on that tap's channel and campaign in **Analytics**. See [Events and revenue in Flutter](https://straitlink.in/docs/sdks/flutter/events/).

## Common problems

- **The link opens a route like `/summer` that doesn't exist.** Flutter's deep linking is still on (step 2).
- **`MissingPluginException` after adding a plugin.** You hot-restarted. Stop the app and `flutter run` again.
- **Android opens the browser instead of the app.** App Links aren't verified yet: usually the wrong SHA-256 in `assetlinks.json`. Run the [App Links checker](https://straitlink.in/tools/app-links-checker/).
- **No deferred link after install.** The build didn't come from Google Play, or the tap went to your website instead of the store.
- **Links from Instagram or WhatsApp stay in the browser.** Instagram usually opens links in its own browser, and WhatsApp can on some phones and versions; the link server detects that and shows an **Open in app** page on Android, or the steps to open Safari on iPhone. See [why links open the browser](https://straitlink.in/blog/instagram-whatsapp-links-open-browser-not-app/).

## Installing the package

`strait_sdk` is on pub.dev. The exact `pubspec.yaml` lines are on the [Flutter install page](https://straitlink.in/docs/sdks/flutter/). Moving from Firebase Dynamic Links? The [migration guide](https://straitlink.in/docs/migrate-from-firebase/) maps `getInitialLink` and `onLink` from the old plugin to the new stream, and the dashboard imports your page.link URLs.

## Sources and how we checked

- Firebase Dynamic Links' shutdown date is from Google's [Dynamic Links deprecation FAQ](https://firebase.google.com/support/dynamic-links-faq). The link behaviour (some 404s, some plain redirects) is from our own `curl` requests to page.link URLs on 5 October 2026.
- The code, the `flutter_deeplinking_enabled` setting and the once-per-install rules are from the Strait Flutter package and its docs. The package's signature code is checked against the same test vectors as the server and the other SDKs.
- The Android deferred path (Play Install Referrer, exact match) was verified on a real Android phone with a Google Play internal testing build of our React Native test app in October 2026. The Flutter package runs the same server flow; we haven't yet recorded a separate Flutter run on a real phone.
- Plugin names and roles are from their pub.dev pages: [app_links](https://pub.dev/packages/app_links), [play_install_referrer](https://pub.dev/packages/play_install_referrer), [flutter_timezone](https://pub.dev/packages/flutter_timezone).
