Install and configure
Install and configure the unified Flutter plugin for your app.
Install a Product Package
Install the product package that matches your implementation.
To use the plugin with Marketing Cloud Engagement, use sfmc_marketingcloudsdk:
1flutter pub add sfmc_marketingcloudsdkTo use the plugin with Marketing Cloud Next, use sfmc_mobileappmessaging:
1flutter pub add sfmc_mobileappmessagingAdd Optional Feature Packages
Both sfmc_marketingcloudsdk and sfmc_mobileappmessaging depend on sfmc_core. When you install one of these packages, the system resolves sfmc_core automatically. Install optional feature packages only when your app requires them.
1flutter pub add sfmc_push
2flutter pub add sfmc_iamInitialize SDK Access in Flutter
Use each module’s requestSdk() API to initialize the native SDK and access typed SDK operations. If you make a subsequent call to requestSdk(), the SDK doesn’t perform any action.
1import 'package:sfmc_core/sfmc_core.dart';
2import 'package:sfmc_marketingcloudsdk/sfmc_marketingcloudsdk.dart';
3
4// Initialize core
5await SFMCSdkModule.requestSdk();
6await SFMCSdkModule.setProfileId('user-123');
7await SFMCSdkModule.setAttribute('plan', 'pro');
8
9await SFMCSdkModule.track(
10 CustomEvent(name: 'purchase', attributes: {'amount': '49.99'}),
11);
12
13// Use the engagement product
14await MarketingCloudSdk.requestSdk();
15final unread = await MarketingCloudSdk.getUnreadMessages();
16if (unread.isNotEmpty) {
17 await MarketingCloudSdk.markMessageRead(unread[0].id!);
18}See each package’s README for full API documentation with links to native SDK docs.
Platform Configuration
After you install the base components, complete the platform-specific setup steps.