Ferry for Flutter
Official Flutter SDK for Ferry, providing direct and deferred deep linking with link-level attribution for iOS and Android.
Installation
flutter pub add ferry_link_flutter
Ferry supports Flutter 3.10 or later, Android API 24 or later, and iOS 15 or later. The package automatically installs the native Ferry SDK from Maven Central on Android and CocoaPods on iOS.
Configure Ferry
Configure Ferry once before starting your app:
import 'package:ferry_link_flutter/ferry_link_flutter.dart';
import 'package:flutter/widgets.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Ferry.configure(publicKey: 'pk_your_project_key');
runApp(const MyApp());
}
Subscribe once near the root of your app. One stream delivers direct app opens and deferred first-install matches:
Ferry.onLink.listen((link) {
if (link.isDeferred) {
// Handle the deferred first-install match.
} else {
// Handle a direct App Link or Universal Link.
}
});
Subscribing starts the deferred-match flow. Use link.isDeferred to
distinguish the two delivery types.
Platform setup
Android
Add an App Links intent filter for every Ferry domain:
<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="go.example.com" />
</intent-filter>
Your domain must serve its Digital Asset Links file at
/.well-known/assetlinks.json.
iOS
In Xcode, add the Associated Domains capability to the Runner target and add one entry for every Ferry domain:
applinks:go.example.com
Your domain must serve its Apple App Site Association file at
/.well-known/apple-app-site-association.
Track events
await Ferry.track(FerryEvents.login);
await Ferry.track(FerryEvents.signup, customerId: 'customer_123');
await Ferry.track(
FerryEvents.purchase(
transactionId: 'txn_123',
value: 9.99,
currency: 'USD',
productId: 'pro_monthly',
),
customerId: 'customer_123',
);
Create links
Client-side link creation must first be enabled for the Ferry project:
try {
final link = await Ferry.createLink(
domain: 'go.example.com',
data: {'screen': 'profile', 'user': '123'},
);
print(link.url);
} on FerryException catch (error) {
print(error.error);
}
See the GitHub repository for the complete example and development documentation.
Libraries
- ferry_link_flutter
- Flutter bindings for Ferry, a deep linking and link attribution service. All matching intelligence lives in the native ferry-android and ferry-ios SDKs; this package only forwards calls to them over platform channels. See the package README for a 5-minute integration guide.