Migration Steps
Migrate your app from the Marketing Cloud Engagement-specific or Marketing Cloud Next-specific Flutter plugins to the unified Flutter plugin.
- Remove the previous plugin package.
- Add the unified product package for each product that you use.
- To use the push or in-app messaging feature packages, add them to your configuration.
- For iOS apps, reinstall your pods.
- Replace static
SFMCSdkandMobileAppMessagingusage with module initialization throughrequestSdk(). - Initialize required modules at app startup and reuse those instances.
- Update method calls based on module ownership and method renames.
| Previous Flutter Plugin Usage | Flutter Unified Plugin Usage | Module |
|---|---|---|
setContactKey, getContactKey | setProfileId, getProfileId | SFMCSdkModule |
setAttribute, clearAttribute, getAttributes, trackEvent | setAttribute, clearAttribute, getAttributes, track (moved) | SFMCSdkModule |
getSystemToken | getPushToken | PushModule |
addTag, removeTag, getTags | same methods (moved) | MarketingCloudSdk |
getMessages, setMessageRead, deleteMessage | getAllMessages, markMessageRead, markMessageDeleted | MarketingCloudSdk |
refreshInbox(callback) | refreshInbox() (no callback. Returns Future<bool>) | MarketingCloudSdk |
analytics, piAnalytics, registration | module-specific methods | MarketingCloudSdk |
MobileAppMessaging.getDeviceId, isAnalyticsEnabled, enableAnalytics, disableAnalytics | same methods (moved) | MobileAppMessaging (sfmc_mobileappmessaging) |
MobileAppMessaging.registerForRegistrationEvents(callback) | setRegistrationCallback() + registrationEvents stream | MobileAppMessaging |
- Find references to previous plugin call sites and update them.
- Rename essential methods:
- Change
getSystemTokentogetPushToken. - Change
getMessagestogetAllMessages. - Change
setMessageReadtomarkMessageRead. - Change
deleteMessagetomarkMessageDeleted.
- Apply these additional required call-site updates:
- Replace analytics boolean setters with explicit methods:
- Change
setAnalyticsEnabled(true|false)toenableAnalytics()/disableAnalytics(). - Change
setPiAnalyticsEnabled(true|false)toenablePiAnalytics()/disablePiAnalytics(). - Replace identity APIs:
- Change
setContactKeytosetProfileIdand changegetContactKeytogetProfileIdonSFMCSdkModule.
- Change
- Update logging and SDK state handling:
- Change
SFMCSdk.enableLogging()anddisableLogging()toSFMCSdkModule.setLogging(LogLevel.debug|LogLevel.none). - Change
logSdkState()toSFMCSdkModule.getSdkState()and log the returned value in your app.
- Change
- Update
refreshInboxcall sites to drop the callback argument. It now returnsFuture<bool>directly. - Adopt new inbox tracking by using
MarketingCloudSdk.trackInboxMessageOpened(id). This method doesn’t have an equivalent in the non-unified plugin.
- Update
CustomEventcalls. Thecategoryargument is removed. Use the dedicated event classes instead.
- Validate event attribute value types. Unified event attributes support these value types:
Stringnumbool
-
Convert unsupported payload values from the previous plugin before tracking.
If payloads from the previous plugin contain nested objects, arrays, or
null, convert them to supported value types. -
Remove unsupported event patterns from the previous plugin:
EventCategory.identitycustom events have no direct equivalent in the unified model. UsesetProfileIdandsetAttributeinstead.CartEvent,OrderEvent, andCatalogObjectEventexist in the unified plugin but are deprecated in favor ofCustomEvent. If you keep using them, note that theirsubtypevalues use short codes, for example,'comment', instead of the previous plugin’s descriptive factory names (for example,"Comment Catalog Object").
- Move callback-based listeners to
Streamsubscriptions.
-
Enable the registration callback before subscribing.
Call
setRegistrationCallback()onMarketingCloudSdkorMobileAppMessagingbefore subscribing to their respectiveregistrationEventsstreams. -
Apply platform listener caveats:
- The inbox response listener,
registerInboxResponseListener, uses the previous callback-list pattern instead of aStream. - Location-watching APIs (
startWatchingLocation,stopWatchingLocation,isWatchingLocation, andgetLastKnownLocation) work only with iOS apps. - Proximity messaging APIs (
enableProximityMessaging,disableProximityMessaging, andisProximityMessagingEnabled) work only with Android apps.
-
Determine when to display an in-app message.
Use this capability only if your app needs to allow or suppress in-app messages based on runtime logic.
- Update both native platforms to the module-based unified configuration model.
-
For Android apps, migrate your
Applicationclass setup to use module-based config blocks.For more information, see Configure Flutter for Android and Integrate the Android SDK.
-
For iOS apps, migrate your
AppDelegate.swiftsetup to use module-based config blocks.For more information, see Configure Flutter for iOS and Integrate the iOS SDK.
-
Reapply existing notification, URL-handling, and delegate customization in the new module configuration.
- Update Android apps to initialize using module-based configuration.
-
Update iOS apps to initialize using module-based configuration.
If you also migrate Marketing Cloud Next, add its builder alongside
setEngagement.
- Verify mandatory platform configuration requirements.
-
Flutter, Dart SDK, iOS, and Android minimums match the unified plugin requirements.
-
Android build minimums match the required versions. For example, minSdk and compileSdk.
-
Android 13+ push permission (
POST_NOTIFICATIONS) is requested for push flows. -
iOS deployment target minimum matches the unified plugin requirement.
-
Keep all existing notification, URL-handling, and delegate forwarding logic when porting to module-based initialization.
For more information, see Prerequisites.
- Find native initialization files and verify your final setup.