ChottuLink for Flutter

Pub Version Platform

ChottuLink is the best deep linking solution for Flutter, offering a drop-in replacement for Firebase Dynamic Links with zero complexity.
It comes with a lightweight Flutter SDK and supports:

  • Universal Deep Links – Open your app from any platform with a single link
  • Deferred Deep Links – Redirect users to the right content even after app install
  • Branded Short Links – Create shareable, professional links with your own branding
  • Advanced Analytics – Track user behavior, clicks, and conversions with ease

ChottuLink ensures fast integration, high performance, and seamless user experiences, making it the #1 choice for Flutter developers.

  • πŸš€ Drop-in Replacement for Firebase Dynamic Links – Easy migration, no complexity.
  • πŸ“± One Link for Both App Stores – Works for Apple App Store & Google Play Store.
  • 🎯 Universal & Deferred Deep Links – Seamless routing even after app install.
  • πŸ”— Branded Short Links – Strengthen your brand identity with custom domains.
  • πŸ“Š Advanced Analytics – Track clicks, installs, and conversions effortlessly.
  • πŸ›  Lightweight Flutter SDK – Minimal size, simple integration, fast performance.

Key Benefits

  • βœ… Flutter-only SDK – Lightweight & fast.
  • βœ… Simple migration from Firebase Dynamic Links.
  • βœ… One link for all stores, all platforms.
  • βœ… Built-in analytics for real-time tracking.

πŸ›  Prerequisites

Before integrating ChottuLink into your iOS app, ensure you have the following:

Development Environment

  • Flutter SDK installed (Flutter v3.3.0 or later recommended)
  • Dart SDK installed (Dart v3.5.0 or later recommended)
  • A working Flutter project targeting iOS 15.0+ and Android 5.0+ (API 21+)
  • Xcode 16.2 or later installed (for iOS)
  • Android Studio or other IDE with Android SDK installed
  • Physical devices or simulators/emulators to run your app
  • Git for version control

πŸ“¦ Installation

1. Add the ChottuLink SDK to your Flutter project:

dependencies:
  flutter:
    sdk: flutter
  chottu_link: ^latest_version

Click here to get the latest version.

2. Then run:

flutter pub get

πŸ“±Platform Specific Configurations

1. For iOS - Click here

2. For Android - Click here

Remember to change:

yourapp.chottu.link to the domain you've set up on ChottuLink Dashboard for your app's links.

Note: You can get the mobile SDK API KEY from ChottuLink Dashboard API Keys section

Initialize the SDK in main.dart:

import 'package:chottu_link/chottu_link.dart';

void main() async {
  /// ⚠️ Make sure to call this before call ChottuLink.init(apiKey: "your_api_key_here").
  WidgetsFlutterBinding.ensureInitialized();

   /// βœ… Initialize the ChottuLink SDK
   /// Make sure to call this before using any ChottuLink features.
   await ChottuLink.init(apiKey: "your_api_key_here");
  
   runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter ChottuLink Demo',
      home: HomeScreen(),
    );
  }
}

πŸ¦‹ Generate Dynamic Links in Flutter

This guide covers how to create a Dynamic Link directly from your Flutter app using Dart.

/// βœ… Import ChottuLink SDK packages
import 'package:chottu_link/chottu_link.dart';
import 'package:chottu_link/dynamic_link/cl_dynamic_link_behaviour.dart';
import 'package:chottu_link/dynamic_link/cl_dynamic_link_parameters.dart';

/// Create dynamic link parameters
final parameters = CLDynamicLinkParameters(
  link: Uri.parse("https://example.com"), // Target deep link
  domain: "yourapp.chottu.link", // Your ChottuLink domain

  // Set behavior for Android & iOS
  androidBehaviour: CLDynamicLinkBehaviour.app,
  iosBehaviour: CLDynamicLinkBehaviour.app,

  // UTM Tracking (for analytics)
  utmCampaign: "exampleCampaign",
  utmMedium: "exampleMedium",
  utmSource: "exampleSource",
  utmContent: "exampleContent",
  utmTerm: "exampleTerm",

  // Optional metadata
  linkName: "linkname",
  selectedPath: "customPath",
  socialTitle: "Social Title",
  socialDescription: "Description to show when shared",
  socialImageUrl: "https://yourdomain.com/image.png", // Must be a valid image URL
);
ChottuLink.createDynamicLink(
  parameters: parameters,
  onSuccess: (link) {
    debugPrint("βœ… Shared Link: $link"); // πŸ”— Successfully created link
  },
  onError: (error) {
    debugPrint("❌ Error creating link: ${error.description}");
  },
);
  • Default behavior is set to .app for both platforms
  • selectedPath is optional - if not provided, a random path will be generated
  • SocialParameters is optional - enhances link previews when shared
  • UTMParameters is optional - helps track campaign performance

πŸ¦‹ Handle Dynamic Links in Flutter

Enable your Flutter app to receive and handle ChottuLinks seamlessly. This allows users to open specific screens when they tap a dynamic link, whether the app is running, in the background, or launched from a cold start. Integrate link handling to ensure a smooth and context-aware user experience across platforms.

πŸ”§ Implementation Guide

/// βœ… Import ChottuLink SDK packages
import 'package:flutter/material.dart';
import 'package:chottulink_flutter_sdk/chottulink_flutter_sdk.dart';

/// πŸ”— Listen for incoming dynamic links
ChottuLink.onLinkReceived.listen((String link) {

  debugPrint(" βœ… Link Received: $link");      

  /// Tip: ➑️ Navigate to a specific page or take action based on the link

});

URL Processing

Process the shortened Deeplink using the getAppLinkDataFromUrl method.
This retrieves the associated app link data and returns a ResolvedLink object containing the resolved destination URL and the original short link.

πŸ“ Method Signature

New Feature
This method was introduced in SDK version v1.0.9+

static Future<void> getAppLinkDataFromUrl({
   required String shortUrl,
   void Function(ResolvedLink resolvedLink)? onSuccess,
   void Function(ChottuLinkError error)? onError,
});

Parameter

Parameter Type Required Description
shortUrl String βœ… Yes The shortened URL string to be resolved
onSuccess Function(ResolvedLink resolvedLink) No Called on successful link resolve
onError Function(ChottuLinkError error) No Called if link resolve fails

πŸ“€ Return Value

class ResolvedLink {
    String? link;
    String? shortLink;
    ResolvedLink({this.link, this.shortLink});
}

πŸ’» Basic Implementation

ChottuLink.getAppLinkDataFromUrl(
   shortUrl: "https://yourApp.chottu.link/xxxxxx",
   onSuccess: (resolvedLink) {
      print("βœ… Link: ${resolvedLink.link}");
      print("βœ… Short Link: ${resolvedLink.shortLink}");
   },
   onError: (error) {
      print("❌ Error: ${error.message}");
   },
);