Skip to main content

Flutter Integration

This guide will help you configure your Flutter app for ChottuLink Dynamic Links. You can complete this setup either during the initial onboarding or later from your project settings.

πŸ›  Prerequisites​

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

Development Environment​

  • Flutter SDK installed (Flutter v3.3.0 or later recommended)
  • Dart SDK installed (Dart v3.1.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
Dart Support β€” v3.5.0

Dart v3.5.0 is supported starting from ChottuLink v1.0.11 and above.

1. For iOS - Click here​

2. For Android - Click here​

πŸ“¦ Installation​

dependencies:
flutter:
sdk: flutter
chottu_link: ^1.0.19

Click here to get the latest version.​

2. Then run:​

flutter pub get

πŸ“±Platform Specific Configurations​

1. For iOS​

Configure Associated Domains​

Associated Domains are configured to securely link your app with your website. Without this setup, features like Universal Links won't function properly, resulting in a less seamless user experience.

  1. Open your project in Xcode
  2. Select your project in the navigator
  3. Select your target under TARGETS
  4. Click on the "Signing & Capabilities" tab
  5. Click the "+" button in the top-left corner of the capabilities section
  6. Search for and select "Associated Domains"

add-capability.png

  1. Add Your Domain
    1. In the Associated Domains section that appears, click the "+" button under "Domains"

    2. Add your domain using the following format:

      applinks:your_dynamic_links_domain

      For example, if your domain is yourapp.chottu.link, you would add:

      applinks:yourapp.chottu.link

      associated-added.png

2. For Android​

Update Your App's Manifest File​

Your app's AndroidManifest.xml file needs a couple of things:

  1. The internet permission (if you haven't added it already).
  2. To know which part of your app should open when a ChottuLink URL is clicked.

Here's how it might look. Make sure to change the highlighted parts!


<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">

<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"/>

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

<!-- Add the highlighted lines in your manifest -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="false"/>

<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"/>

<!-- Change "yourapp.chottu.link" to the special domain you set up for your ChottuLink URLs -->
<data
android:scheme="https"
android:host="yourapp.chottu.link"/>
</intent-filter>
</activity>
tip

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(),
);
}
}

βœ… Next Steps​

After completing the Flutter setup:

  1. Create your first Dynamic Link
  2. Receive Dynamic Link