SFMC Core
Marketing Cloud Engagement SDK
Marketing Cloud Mobile App Messaging SDK
Push Messaging
In-App Messaging
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
This section provides API reference details for the SFMC Core module in the Flutter unified plugin.
Sets the profile identifier for the device’s user.
1SFMCSdkModule.setProfileId(profileId);| Parameter | Type | Description |
|---|---|---|
profileId | String | The value to set as the profile ID of the device’s user. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setProfileId('user-1234');Returns the profile identifier for the device.
1SFMCSdkModule.getProfileId();Future<String?> - A future that completes with the current profile ID.1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4final profileId = await SFMCSdkModule.getProfileId();Sets the value of an attribute in the identity.
1SFMCSdkModule.setAttribute(key, value);| Parameter | Type | Description |
|---|---|---|
key | String | The name of the attribute to set. |
value | String | The value of the attribute to set. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setAttribute('email', 'sample@example.com');Clears the value of an attribute in the identity.
1SFMCSdkModule.clearAttribute(key);| Parameter | Type | Description |
|---|---|---|
key | String | The name of the attribute to clear the value of. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.clearAttribute('email');Sets multiple attributes in the identity in one call.
1SFMCSdkModule.setAttributes(attributes);| Parameter | Type | Description |
|---|---|---|
attributes | Map<String, String> | A map of key-value pairs to set. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setAttributes({
5 'email': 'sample@example.com',
6 'tier': 'gold',
7});Returns a map of attributes for the identity.
1SFMCSdkModule.getAttributes();Future<Map<String, String>?> - A future that completes with the current attribute map.1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4final attributes = await SFMCSdkModule.getAttributes();Clears all attributes from the identity.
1SFMCSdkModule.clearAllAttributes();Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.clearAllAttributes();Returns the party identification name currently for the device.
1SFMCSdkModule.getPartyIdentificationName();Future<String?> - A future that completes with the current party identification name.1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4final partyName = await SFMCSdkModule.getPartyIdentificationName();Sets the party identification name for the device’s user.
1SFMCSdkModule.setPartyIdentificationName(name);| Parameter | Type | Description |
|---|---|---|
name | String | The display name or full name of the user. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setPartyIdentificationName('Jane Doe');Returns the party identification number of the device.
1SFMCSdkModule.getPartyIdentificationNumber();Future<String?> - A future that completes with the current party identification number.1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4final partyNumber = await SFMCSdkModule.getPartyIdentificationNumber();Sets the party identification number for the device’s user.
1SFMCSdkModule.setPartyIdentificationNumber(number);| Parameter | Type | Description |
|---|---|---|
number | String | A unique identifier number for the user. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setPartyIdentificationNumber('PID-1001');Returns the party identification type currently set on the device.
1SFMCSdkModule.getPartyIdentificationType();Future<String?> - A future that completes with the current party identification type.1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4final partyType = await SFMCSdkModule.getPartyIdentificationType();Sets the party identification type for the device’s user.
1SFMCSdkModule.setPartyIdentificationType(type);| Parameter | Type | Description |
|---|---|---|
type | String | The category or classification for the user. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setPartyIdentificationType('customer');Tracks an event, which could result in actions such as an in-app message being displayed.
1SFMCSdkModule.track(event);| Parameter | Type | Description |
|---|---|---|
event | SFMCEvent | An SFMCEvent instance to track, such as CustomEvent or CartEvent. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.track(CustomEvent(name: 'purchase', attributes: {'item': 'shoes'}));Tracks an event and sends it immediately without waiting for the next batch cycle.
1SFMCSdkModule.sendImmediate(event);| Parameter | Type | Description |
|---|---|---|
event | SFMCEvent | An SFMCEvent instance to send immediately, such as CustomEvent or CartEvent. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.sendImmediate(CustomEvent(name: 'purchase', attributes: {'item': 'shoes'}));Flushes all queued events to the Marketing Cloud servers immediately.
1SFMCSdkModule.flush();Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.flush();Sets the log level for the native Marketing Cloud SDK.
1SFMCSdkModule.setLogging(level);| Parameter | Type | Description |
|---|---|---|
level | LogLevel | The SDK log level. Valid values are LogLevel.debug, LogLevel.warn, LogLevel.error, and LogLevel.none. |
Future<void>1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4await SFMCSdkModule.setLogging(LogLevel.debug);Returns the SDK state for diagnostics.
1SFMCSdkModule.getSdkState();Future<dynamic> - A future that completes with the state of the SDK. The state is usually returned as a Map<dynamic, dynamic> object, but the native SDK can emit non-strict JSON that fails to parse. In this situation, the SDK returns the raw JSON string instead. Parse the result in a way that can handle both object types.1import 'package:sfmc_core/sfmc_core.dart';
2
3await SFMCSdkModule.requestSdk();
4final state = await SFMCSdkModule.getSdkState();