appsflyer_analytics_impl Free
AppsFlyer Analytics vendor implementation for the analytics_api contract.
Version: 1.0.0
Variables
| Variable | Type | Default | Description |
|---|---|---|---|
| appName | string | — | The name of your application |
| isForMonorepo | boolean | true | Whether this is being generated as part of a monorepo |
Architecture
This brick generates a single vendor implementation package that plugs into the analytics_sdk orchestration layer:
AppsFlyerAnalyticsVendor— ImplementsAnalyticVendorusingAppsflyerSdk, registered as@Named(AnalyticInjectorKey.appsFlyerImpl)AppsFlyerRegisterModule— Injectable module that provides theAppsflyerSdksingleton, configured fromAppEnv.appsflyerDevKeyandAppEnv.appsflyerAppId- MicroPackage DI —
@InjectableInit.microPackage()oninitAppsflyerAnalyticsImplModule()for modular registration into the root DI graph
The vendor reads API keys from app_config (AppEnv.appsflyerDevKey, AppEnv.appsflyerAppId), so no hardcoded credentials are needed in the brick output.
SDK Initialization
AppsFlyer requires appsflyerSdk.initSdk() to be called during app bootstrap before any event tracking occurs. This is done in the app initializer, not inside this package.
Generated Structure
infrastructure/
└── appsflyer_analytics_impl/
├── lib/
│ ├── appsflyer_analytics_impl.dart # Package barrel export
│ └── src/
│ ├── appsflyer_analytics_vendor.dart # AnalyticVendor impl
│ └── di/
│ ├── injector.dart # microPackage DI entry
│ └── register_module.dart # AppsflyerSdk provider
└── pubspec.yamlKey Features
- Direct SDK pass-through — Events are forwarded as AppsFlyer in-app events via
logEvent(name, params)with no transformation - User identification —
setUserIdmaps tosetCustomerUserId - User properties —
setUserPropertymaps tosetAdditionalData({key: value}) - Reset — Clears the customer user ID as a best-effort reset (AppsFlyer has no native reset API)
- Named DI — Registered under
AnalyticInjectorKey.appsFlyerImplfor unambiguous resolution alongside other vendors
Configuration
The following environment values must be present in app_config (AppEnv):
| Key | Description |
|---|---|
appsflyerDevKey | AppsFlyer Dev Key from the AppsFlyer dashboard |
appsflyerAppId | App Store / Play Store App ID (iOS App ID for unified config) |
These are injected at build time via app_config — no runtime secrets are needed in this package.
Dependencies
| Package | Version | Purpose |
|---|---|---|
appsflyer_sdk | ^6.17.8 | AppsFlyer Flutter SDK |
analytics_api | workspace | Vendor contract (AnalyticVendor, TrackData) |
app_config | workspace | Access to AppEnv for API keys |
dependencies | workspace | Shared DI annotations (injectable) |