Skip to main content

Flutter SDK for Dart

Add install tracking and purchase attribution to your Flutter app. Single codebase, full attribution support for both iOS and Android.

Quick start

Track your first install in under 5 minutes.

import 'package:appfiliate/appfiliate.dart';

// In main() or initState():
Appfiliate.configure(appId: 'APP_ID', apiKey: 'API_KEY');
await Appfiliate.trackInstall();

Get your App ID and API Key from your Appfiliate dashboard.

Integration guide

Step-by-step instructions to integrate the Appfiliate Flutter SDK.

1

Add the dependency

Add to your pubspec.yaml:

dependencies:
  appfiliate: ^1.0.0

Then run:

flutter pub get
2

Configure and track installs

Find your main() function or your main widget's initState. Add the following:

import 'package:appfiliate/appfiliate.dart';

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

  Appfiliate.configure(appId: 'APP_ID', apiKey: 'API_KEY');
  await Appfiliate.trackInstall();

  runApp(const MyApp());
}

trackInstall() only fires once per install — it's safe to call on every launch.

3

Track purchases (optional)

After a successful in-app purchase, call trackPurchase():

await Appfiliate.trackPurchase(
    productId: 'premium_monthly',
    revenue: 9.99,
    currency: 'USD',
    transactionId: purchaseDetails.purchaseID,
);
4

Set user ID for webhooks (optional)

If you use RevenueCat, Superwall, Adapty, Qonversion, or Stripe, link the user ID so purchases are attributed automatically:

// RevenueCat example
await Appfiliate.setUserId(await Purchases.appUserID);

// Stripe example
await Appfiliate.setUserId(stripeCustomerId);

Automatic Purchase Tracking

RevenueCat webhook integration

Connect RevenueCat and every purchase, renewal, and cancellation is attributed automatically. No manual trackPurchase() calls needed.

1. Add one line of code

Appfiliate.configure(appId: 'APP_ID', apiKey: 'API_KEY');
await Appfiliate.trackInstall();
await Appfiliate.setUserId(await Purchases.appUserID);

2. Paste the webhook URL

In your RevenueCat dashboard, go to Integrations → Webhooks and paste:

https://us-central1-appfiliate-5a18b.cloudfunctions.net/api/v1/webhooks/revenuecat

Start tracking Flutter installs today

3 lines of code. Cross-platform iOS and Android support. Free plan included.