Dynalink Flutter Plugin
The Dynalink Flutter plugin simplifies the management of deep links and dynamic links in your Flutter applications. With its seamless integration, the plugin provides robust functionality to handle incoming deep links, generate dynamic links, and create shortened URLs for sharing.
Key Features:
- Deep Link Handling: Easily capture and process incoming deep links to navigate users to specific app screens.
- Dynamic Link Creation: Generate dynamic links for flexible content sharing across platforms.
- Shortened URL Generation: Create compact and shareable URLs for marketing campaigns and improved user experience.
- Custom Parameters: Add custom data to your links to provide personalized experiences for your users.
- Cross-Platform Support: Works on both iOS and Android with minimal setup.
Use Cases:
- Share app-specific content with dynamic or shortened links.
- Deeply integrate external referrals or promotions into your app.
- Simplify link generation for social media campaigns or email marketing.
This plugin is designed to streamline link management in Flutter apps, making it an essential tool for developers aiming to enhance user engagement and sharing functionality.
Installation and Initialization of Dynalink Flutter Plugin
Follow these steps to install and initialize the Dynalink plugin for Flutter:
Step 1: Create the project
Create your project at https://dynalink.app. Note your project Id, Project prefix and Project Key generated. Save the project key securely for later use.
Step 2: Install the plugin
- Add the following line to your
pubspec.yaml
file:dependencies: dynalink: latest
- Run
flutter pub get
to install the plugin.
Step 3: Configure Platforms
For Android:
- Update the AndroidManifest.xml file 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="dynalink-{projectId}" android:host="dynalink.app" /> </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="{projectPrefix}.dynalink.app" /> </intent-filter>
- Add Assets Link to your project in Admin Panel, see how to generate here
For iOS:
- Open the
ios/Runner/Info.plist
file and add:<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>{bundleId}</string> <key>CFBundleURLSchemes</key> <array> <string>dynalink-{projectId}</string> </array> </dict> </array> <key>NSUserActivityTypes</key> <array> <string>NSUserActivityTypeBrowsingWeb</string> </array> <key>LSApplicationQueriesSchemes</key> <array> <string>dynalink-{projectId}</string> </array> <key>CFBundleAssociatedDomains</key> <array> <string>applinks:{projectPrefix}.dynalink.app</string> </array> <key>FlutterDeepLinkingEnabled</key> <false/>
- Add ios apple association site to your project in Admin Panel, see how to generate here
Step 3: Initialize the Plugin
In your main.dart
file, initialize the Dynalink plugin in the main
function:
import 'package:dynalink/dynalink.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize Dynalink
await Dynalink.initialize(
projectId: '{projectId}',
projectKey: '{projectKey}',
);
runApp(MyApp());
}
Features of the Dynalink Flutter Plugin
1. Handle Incoming Deep Links
Automatically capture and handle deep links to navigate users to specific screens within the app.
- Example:
Dynalink.instance.dynamicLinkStream.listen((String? url) { if (url != null) { print("Received deep link: $url"); // Navigate based on the path or parameters in the URI } });
2. Generate Dynamic Links
Create flexible dynamic links with optional custom parameters to direct users to specific app content.
- Example:
final dynaLink = await Dynalink.instance.createShortenedLink( CreateDynalinkForm( url: "your dynamic link url", iosUrl: "your app store url", androidUrl: "your play store url", socialTitle: "your social title", socialDescription: "your social description", socialImage: "your social image url", fallbackUrl: "your fallback url", ), ); print("dynaLink Link: $dynaLink");
3. How to test
- Test the Play Store Install Referrer API: Follow the steps in the medium article to test the Play Store Install Referrer API.
Use Cases
- Deep Linking: Navigate to app screens based on incoming links.
- Content Sharing: Easily share content with dynamic or shortened URLs.
- Custom Campaigns: Track campaigns using custom parameters in links.
This setup ensures your app is fully equipped to handle deep and dyna links, improving user engagement and marketing outreach.