Configuration
1. Add the dependency
Section titled “1. Add the dependency”Add affise_attribution_lib to your pubspec.yaml:
dependencies: affise_attribution_lib: ^1.7.16Or run flutter pub add affise_attribution_lib.
Alternatively, use a Git dependency:
dependencies: affise_attribution_lib: git: url: https://github.com/affise/affise-mmp-sdk-flutterOptional module packages
Section titled “Optional module packages”Since 1.7.14/1.7.15 every native Affise module is also published as a Flutter wrapper package. Add only the ones you need (each module page lists its package):
dependencies: affise_attribution_lib: ^1.7.16 affise_attribution_module_adservice: ^1.7.16 affise_attribution_module_advertising: ^1.7.16 affise_attribution_module_androidid: ^1.7.16 affise_attribution_module_appsflyer: ^1.7.16 affise_attribution_module_google: ^1.7.16 affise_attribution_module_huawei: ^1.7.16 affise_attribution_module_link: ^1.7.16 affise_attribution_module_meta: ^1.7.16 affise_attribution_module_network: ^1.7.16 affise_attribution_module_persistent: ^1.7.16 affise_attribution_module_phone: ^1.7.16 affise_attribution_module_rustore: ^1.7.16 affise_attribution_module_status: ^1.7.16 affise_attribution_module_subscription: ^1.7.16 affise_attribution_module_tiktok: ^1.7.16| Package | Android | iOS |
|---|:-:|:-:|
| affise_attribution_module_adservice | — | ✓ |
| affise_attribution_module_advertising | ✓ | ✓ |
| affise_attribution_module_androidid | ✓ | — |
| affise_attribution_module_appsflyer | ✓ | ✓ |
| affise_attribution_module_google | — | ✓ |
| affise_attribution_module_huawei | ✓ | — |
| affise_attribution_module_link | ✓ | ✓ |
| affise_attribution_module_meta | ✓ | — |
| affise_attribution_module_network | ✓ | — |
| affise_attribution_module_persistent | — | ✓ |
| affise_attribution_module_phone | ✓ | — |
| affise_attribution_module_rustore | ✓ | — |
| affise_attribution_module_status | ✓ | ✓ |
| affise_attribution_module_subscription | ✓ | ✓ |
| affise_attribution_module_tiktok | ✓ | ✓ |
The packages have no Dart API — they only add the native module dependency (com.affise:module-* on Android, AffiseModule/* on iOS). Alternatively, add the native dependencies to android/app/build.gradle / ios/Podfile manually, as described on each module page.
2. Fetch packages
Section titled “2. Fetch packages”flutter pub get3. Platform configuration
Section titled “3. Platform configuration”Add the INTERNET permission to your AndroidManifest.xml:
<manifest> <uses-permission android:name="android.permission.INTERNET"/></manifest>Add NSUserTrackingUsageDescription to your Info.plist. It is required for the AppTrackingTransparency framework’s advertisingIdentifier, and the app will crash if the key is missing when the Advertising module is active.
<plist version="1.0"><dict> ... <key>NSUserTrackingUsageDescription</key> <string>Youre permission text</string></dict>4. Initialize the plugin
Section titled “4. Initialize the plugin”Call Affise.settings(...) inside your State.initState:
import 'package:flutter/foundation.dart';import 'package:affise_attribution_lib/affise.dart';
class _MyAppState extends State<MyApp> { @override void initState() { super.initState();
Affise .settings( affiseAppId: "Your appId", //Change to your app id secretKey: "Your SDK secretKey", //Change to your SDK secretKey ) .start(); // Start Affise SDK }}Affise.settings(...) (lib/affise.dart:16) returns an AffiseSettings builder (lib/settings/affise_settings.dart:8). Calling start() (lib/settings/affise_settings.dart:122) schedules the init on the next frame via SchedulerBinding.instance.addPostFrameCallback.
Next steps
Section titled “Next steps”For production/debug mode, custom domain, module disabling, init callbacks, and config values, see Optional setup.