Skip to content

appsflyer_analytics_impl Free

AppsFlyer Analytics vendor implementation for the analytics_api contract.

Version: 1.0.0

Variables

VariableTypeDefaultDescription
appNamestringThe name of your application
isForMonorepobooleantrueWhether 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 — Implements AnalyticVendor using AppsflyerSdk, registered as @Named(AnalyticInjectorKey.appsFlyerImpl)
  • AppsFlyerRegisterModule — Injectable module that provides the AppsflyerSdk singleton, configured from AppEnv.appsflyerDevKey and AppEnv.appsflyerAppId
  • MicroPackage DI@InjectableInit.microPackage() on initAppsflyerAnalyticsImplModule() 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.yaml

Key Features

  • Direct SDK pass-through — Events are forwarded as AppsFlyer in-app events via logEvent(name, params) with no transformation
  • User identificationsetUserId maps to setCustomerUserId
  • User propertiessetUserProperty maps to setAdditionalData({key: value})
  • Reset — Clears the customer user ID as a best-effort reset (AppsFlyer has no native reset API)
  • Named DI — Registered under AnalyticInjectorKey.appsFlyerImpl for unambiguous resolution alongside other vendors

Configuration

The following environment values must be present in app_config (AppEnv):

KeyDescription
appsflyerDevKeyAppsFlyer Dev Key from the AppsFlyer dashboard
appsflyerAppIdApp 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

PackageVersionPurpose
appsflyer_sdk^6.17.8AppsFlyer Flutter SDK
analytics_apiworkspaceVendor contract (AnalyticVendor, TrackData)
app_configworkspaceAccess to AppEnv for API keys
dependenciesworkspaceShared DI annotations (injectable)

Built by Banua Coder