Flutter Setup

Last updated on Sep 08, 2026

Use this walkthrough to integrate flutter_linkme_sdk in a Flutter app.

Before you start

  • A LinkMe app configured with your iOS bundle ID and Android package name
  • Flutter 3.44 or newer and Dart 3.12 or newer
  • Xcode 15 or newer for iOS/macOS builds
  • Access to update iOS entitlements and the Android manifest
  • API keys from App Settings → API Keys

1. Install the plugin

flutter pub add flutter_linkme_sdk

The SwiftPM-compatible release is flutter_linkme_sdk 0.3.4:

dependencies:
  flutter_linkme_sdk: ^0.3.4

Flutter 3.44+ enables Swift Package Manager by default. The plugin packages are discovered from ios/flutter_linkme_sdk/Package.swift and macos/flutter_linkme_sdk/Package.swift. They depend on Flutter's generated FlutterFramework package and LinkMeKit 0.2.16.

2. Configure iOS

Set the Runner deployment target to iOS 14 or newer. In Xcode, enable Signing & Capabilities → Associated Domains and add:

applinks:links.yourco.com

LinkMe hosts the AASA file after the domain is connected in the portal. Add a custom URL scheme under CFBundleURLSchemes if your app uses one.

3. Configure Android

In android/app/src/main/AndroidManifest.xml, add an HTTPS App Link intent filter to the launch 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="links.yourco.com" />
</intent-filter>

Add a custom scheme intent filter as well if your app needs scheme-based fallback routing.

4. Initialize LinkMe

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_linkme_sdk/flutter_linkme_sdk.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await LinkMe.shared.configure(
    const LinkMeConfig(
      baseUrl: 'https://links.yourco.com',
      appId: String.fromEnvironment('LINKME_APP_ID'),
      appKey: String.fromEnvironment('LINKME_APP_KEY'),
    ),
  );

  final initial = await LinkMe.shared.getInitialLink();
  final deferred = initial == null
      ? await LinkMe.shared.claimDeferredIfAvailable()
      : null;

  runApp(App(initialPayload: initial, deferredPayload: deferred));
}

class App extends StatefulWidget {
  const App({super.key, this.initialPayload, this.deferredPayload});
  final LinkMePayload? initialPayload;
  final LinkMePayload? deferredPayload;

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  late final StreamSubscription<LinkMePayload> subscription;

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) {
      if (!mounted) return;
      final payload = widget.initialPayload ?? widget.deferredPayload;
      if (payload != null) routeUser(payload);
    });
    subscription = LinkMe.shared.onLink.listen(routeUser);
  }

  @override
  void dispose() {
    subscription.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) => const MaterialApp(home: Placeholder());

  void routeUser(LinkMePayload payload) {
    // Navigate based on payload.path and payload.params.
  }
}

Call LinkMe.shared.setAdvertisingConsent(true) after your consent flow. Pasteboard behavior for iOS is controlled from App Settings → iOS in the LinkMe portal.

5. Test the integration

From the plugin example or your app:

flutter pub get
flutter run

Test an installed-app Universal Link/App Link and a first-install deferred link on both platforms. Use --dart-define=LINKME_APP_ID=… and --dart-define=LINKME_APP_KEY=… to keep keys out of source.

Troubleshooting

  • If iOS resolves through Safari, verify the Associated Domains entitlement, Team ID, bundle ID, and AASA response.
  • If Android does not verify the App Link, check the package name, signing fingerprint, host, and assetlinks.json.
  • If the native package is not found, use Flutter 3.44+ and regenerate the iOS/macOS project files.
  • If deferred attribution is missing, enable the portal’s Pasteboard setting or verify the fingerprint fallback configuration.

See the Flutter SDK reference for the complete API surface.