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.8Alternatively, use a Git dependency:
dependencies: affise_attribution_lib: git: url: https://github.com/affise/affise-mmp-sdk-flutter2. 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.