Skip to content

moengage_analytics_impl Free

MoEngage 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:

  • MoEngageAnalyticsVendor — Implements AnalyticVendor using MoEngageFlutter, registered as @Named(AnalyticInjectorKey.moEngageImpl)
  • MoEngageRegisterModule — Injectable module that provides the MoEngageFlutter singleton, configured with AppEnv.moengageAppId
  • MicroPackage DI — Standard @InjectableInit.microPackage() entry point for modular registration

The vendor reads the app ID from app_config (AppEnv.moengageAppId). Event parameters are mapped through MoEngage's MoEProperties builder, which provides typed attribute handling.

Generated Structure

infrastructure/
└── moengage_analytics_impl/
    ├── lib/
    │   ├── moengage_analytics_impl.dart   # Package barrel export
    │   └── src/
    │       ├── moengage_analytics_vendor.dart  # AnalyticVendor impl
    │       └── di/
    │           ├── injector.dart               # microPackage DI entry
    │           └── register_module.dart        # MoEngageFlutter provider
    └── pubspec.yaml

Key Features

  • Properties builder pattern — Event parameters from data.params are iterated and added to a MoEProperties instance via addAttribute(key, value) before being passed to trackEvent, providing MoEngage's typed attribute handling
  • User identificationsetUserId calls moEngage.identifyUser(userId)
  • User attributessetUserProperty maps to moEngage.setUserAttribute(key, value) for MoEngage user profile attributes
  • Reset / logoutreset() calls moEngage.logout(), ending the current user session
  • Named DI — Registered under AnalyticInjectorKey.moEngageImpl for unambiguous resolution alongside other vendors

Configuration

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

KeyDescription
moengageAppIdMoEngage App ID from the MoEngage dashboard

This is injected at build time via app_config — no runtime secrets are needed in this package.

MoEngage also requires native-level initialization. Follow the MoEngage Flutter integration guide to configure the Android and iOS native sides before events will be received.

Dependencies

PackageVersionPurpose
moengage_flutter^10.3.0MoEngage Flutter SDK
analytics_apiworkspaceVendor contract (AnalyticVendor, TrackData)
app_configworkspaceAccess to AppEnv for the App ID
dependenciesworkspaceShared DI annotations (injectable)

Built by Banua Coder