moengage_analytics_impl Free
MoEngage 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:
MoEngageAnalyticsVendor— ImplementsAnalyticVendorusingMoEngageFlutter, registered as@Named(AnalyticInjectorKey.moEngageImpl)MoEngageRegisterModule— Injectable module that provides theMoEngageFluttersingleton, configured withAppEnv.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.yamlKey Features
- Properties builder pattern — Event parameters from
data.paramsare iterated and added to aMoEPropertiesinstance viaaddAttribute(key, value)before being passed totrackEvent, providing MoEngage's typed attribute handling - User identification —
setUserIdcallsmoEngage.identifyUser(userId) - User attributes —
setUserPropertymaps tomoEngage.setUserAttribute(key, value)for MoEngage user profile attributes - Reset / logout —
reset()callsmoEngage.logout(), ending the current user session - Named DI — Registered under
AnalyticInjectorKey.moEngageImplfor unambiguous resolution alongside other vendors
Configuration
The following environment value must be present in app_config (AppEnv):
| Key | Description |
|---|---|
moengageAppId | MoEngage 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
| Package | Version | Purpose |
|---|---|---|
moengage_flutter | ^10.3.0 | MoEngage Flutter SDK |
analytics_api | workspace | Vendor contract (AnalyticVendor, TrackData) |
app_config | workspace | Access to AppEnv for the App ID |
dependencies | workspace | Shared DI annotations (injectable) |