zerolink 0.0.1 copy "zerolink: ^0.0.1" to clipboard
zerolink: ^0.0.1 copied to clipboard

Flutter plugin for ZeroLink - Open-Source Dynamic Links

ZeroLink Flutter Plugin #

The ZeroLink Flutter plugin provides deep linking and deferred deep linking support for your Flutter applications. It's the official Flutter SDK for ZeroLink - the open-source, self-hosted Firebase Dynamic Links replacement.

Features #

  • Deep Link Handling: Capture and process incoming deep links to navigate users to specific app screens
  • Deferred Deep Linking: Preserve link context through app install (similar to Firebase Dynamic Links)
  • Dynamic Link Creation: Generate short URLs programmatically
  • Multi-tier Matching: Supports session ID (Android), fingerprint, fuzzy, and IP-only matching
  • Cross-Platform Support: Works on both iOS and Android

Installation #

Step 1: Add the dependency #

Add the following to your pubspec.yaml:

dependencies:
  zerolink: ^0.0.1

Run flutter pub get to install.

Step 2: Configure Platforms #

Android

Update your AndroidManifest.xml to handle deep links:

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="{zerolink-custom-scheme}" android:host="zerol.ink" />
</intent-filter>

<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}.zerol.ink" /> // or custom domain if configured
</intent-filter>

iOS

Update your ios/Runner/Info.plist:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>{bundleId}</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>{zerolink-custom-scheme}</string>
        </array>
    </dict>
</array>

<key>NSUserActivityTypes</key>
<array>
    <string>NSUserActivityTypeBrowsingWeb</string>
</array>

<key>FlutterDeepLinkingEnabled</key>
<false/>

Add Associated Domains capability in Xcode with:

applinks:{yourDomain}.zerol.ink

or custom domain if configured.

applinks:yourcustomdomain.com

Step 3: Initialize the Plugin #

In your main.dart:

import 'package:zerolink/zerolink.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Zerolink.initialize(
    apiKey: 'your-api-key',
  );

  runApp(MyApp());
}

Usage #

Zerolink.instance.dynamicLinkStream.listen((String deepLink) {
  print("Received deep link: $deepLink");
  // Navigate based on the deep link
});
final shortLink = await Zerolink.instance.createLink(
  CreateZerolinkForm(
    deepLink: "myapp://product/123",
    iosDeepLink: "myapp://ios/product/123",  // Optional: iOS-specific
    androidDeepLink: "myapp://android/product/123",  // Optional: Android-specific
    webFallback: "https://myapp.com/product/123",
    title: "Amazing Product",
    description: "Check out this amazing product!",
    imageUrl: "https://myapp.com/images/product.jpg",
  ),
);

print("Short Link: $shortLink");  // https://yourdomain.zerol.ink/l/abc123

How Deferred Deep Linking Works #

  1. User clicks a ZeroLink URL on mobile web
  2. ZeroLink creates a session with device fingerprint
  3. User is redirected to App Store / Play Store
  4. After install, the SDK matches the session using:
    • Android: Install Referrer (100% accurate)
    • iOS: Fingerprint matching (IP + UserAgent + TimeBucket)
  5. Original deep link is retrieved and delivered to your app

Matching Priority #

Priority Method Platform Confidence
1 Session ID (Install Referrer) Android 100%
2 Exact Fingerprint iOS/Android High
3 Fuzzy Match (IP + UA) iOS Medium
4 IP Only iOS Low

License #

MIT License - see LICENSE for details.