Migrate to Flutter Unified Plugin
Migrate from the Marketing Cloud Engagement-specific or the Marketing Cloud Next-specific Flutter plugins to the unified Flutter plugin model.
The previous Flutter integration for Marketing Cloud Engagement uses one monolithic package (sfmc) and one static class (SFMCSdk) for all features. Similarly, the integration for Marketing Cloud Next uses a separate monolithic package (mam) with its own static class (MobileAppMessaging).
The key changes in the Flutter unified implementation are:
- The previous monolithic packages are split into focused packages:
sfmc_corefor core services,sfmc_pushfor push notifications,sfmc_iamfor in-app messaging,sfmc_marketingcloudsdkfor Marketing Cloud Engagement, andsfmc_mobileappmessagingfor Marketing Cloud Next. - Static method calls are replaced with async module initialization using
requestSdk(). - Identity, attribute, and event-tracking methods are moved to
sfmc_core. - In-App Messaging (
sfmc_iam) is a new, optional feature package with lifecycle events and display control. No equivalent existed in the previous Engagement-specific Flutter plugin. - Several callback-based listeners, such as the listeners for registration events and push tokens, are replaced with Dart streams that use
EventChannel.
Use this table to map dependencies from the previous, non-unified plugin to their equivalent packages in the unified plugin.
| Previous Flutter dependency | Unified Dependency | Required? |
|---|---|---|
sfmc (MobilePush / Engagement) | sfmc_marketingcloudsdk | Required. This package replaces the Engagement-specific package. |
mam (Marketing Cloud Next) | sfmc_mobileappmessaging | Required. This package replaces the Marketing Cloud Next-specific package. |
Identity, attributes, and events bundled inside sfmc | sfmc_core | Auto-installed as a transitive dependency of any product package. |
Push messaging support bundled inside sfmc | sfmc_push | Required if your app sends push notifications. |
| No Dart equivalent (native-only or config-only) | sfmc_iam | Required if your app uses in-app messages. This is a new capability with a Dart API. |
Before you begin your migration, make sure you meet these prerequisites:
- Have your existing Marketing Cloud configuration values—such as App ID, Access Token, Server URL, and MID—available.
- Perform the migration on a feature branch. Avoid mixing the migration with unrelated work.
- Be prepared to update both Dart call sites and native (Android and iOS) setup files.
- Make sure your app meets these minimum requirements:
| Components | Minimum Requirement |
|---|---|
| Flutter | 3.3.0 or later |
| Dart SDK | >=3.0.6 <4.0.0 |
| iOS | 12.0 or later |
| Android | minSdk 26, compileSdk 36 |