This module enables the integration of the Marketing Cloud Engagement MobilePush SDK into your Flutter applications.
For release notes, please refer to CHANGELOG.md.
- Flutter version
3.3.0+
- minimum deployment target
iOS 12+
- minSdkVersion
21+
- compileSdkVersion
34+
To add the plugin to your application via pub, run the following command:
flutter pub add sfmc
An example implementation is provided within the plugin. For setup details, see the example app.
Please follow detailed step by step guide to setup Android Platform.
Please follow detailed step by step guide for Swift or Objective-C to setup iOS Platform.
To handle URLs from push notifications, please follow iOS step by step guide for Swift or Objective-C and Android step by step guide.
Please also see additional documentation on URL Handling for Android and iOS.
In your app import
the package and utilize the SFMCSdk
APIs.
// Import the SFMC package into your application
import 'package:sfmc/sfmc.dart';
// Utilize the APIs
SFMCSdk.getSystemToken();
Please find the API Refrences below.
Kind: global class
- SFMCSdk
- .isPushEnabled() ⇒
Future<bool?>
- .enablePush() ⇒
Future<void>
- .disablePush() ⇒
Future<void>
- .getSystemToken() ⇒
Future<String?>
- .getAttributes() ⇒
Future<Map<Object?, Object?>?>
- .setAttribute(key, value) ⇒
Future<void>
- .clearAttribute(key) ⇒
Future<void>
- .addTag(tag) ⇒
Future<void>
- .removeTag(tag) ⇒
Future<void>
- .getTags() ⇒
Future<List<String>>
- .setContactKey(contactKey) ⇒
Future<void>
- .getContactKey() ⇒
Future<String?>
- .enableLogging() ⇒
Future<void>
- .disableLogging() ⇒
Future<void>
- .logSdkState() ⇒
Future<void>
- .trackEvent(event) ⇒
Future<void>
- .getDeviceId() ⇒
Future<String?>
- .setAnalyticsEnabled(analyticsEnabled) ⇒
Future<void>
- .isAnalyticsEnabled() ⇒
Future<bool>
- .setPiAnalyticsEnabled(analyticsEnabled) ⇒
Future<void>
- .isPiAnalyticsEnabled() ⇒
Future<bool>
- .getMessages() ⇒
Future<List<InboxMessage>>
- .getReadMessages() ⇒
Future<List<InboxMessage>>
- .getUnreadMessages() ⇒
Future<List<InboxMessage>>;
- .getDeletedMessages() ⇒
Future<List<InboxMessage>>;
- .getMessageCount() ⇒
Future<int?>
- .getReadMessageCount() ⇒
Future<int?>
- .getUnreadMessageCount() ⇒
Future<int?>
- .getDeletedMessageCount() ⇒
Future<int?>
- .setMessageRead.(messageId) ⇒
Future<void>
- .deleteMessage.(messageId) ⇒
Future<void>
- .markAllMessagesRead.(messageId) ⇒
Future<void>
- .markAllMessagesDeleted.(messageId) ⇒
Future<void>
- .refreshInbox() ⇒
Future<bool>
- .registerInboxResponseListener(InboxRefreshListener callback) ⇒
void
- .unregisterInboxResponseListener(InboxRefreshListener callback) ⇒
void
- .isPushEnabled() ⇒
The current state of the pushEnabled flag in the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
Returns: Future<bool?>
- A future to the nullable boolean representation of whether push is
enabled.
See
Enables push messaging in the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
Disables push messaging in the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
Returns the token used by the Marketing Cloud to send push messages to the device.
Kind: static method of SFMCSdk
Returns: Future<String?>
- A future to the nullable system token string.
See
Returns the maps of attributes set in the registration.
Kind: static method of SFMCSdk
Returns: Future<Map<String, String>>
- A future to the string key/value map of attributes set
in the registration.
See
Sets the value of an attribute in the registration.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
key | string |
The name of the attribute to be set in the registration. |
value | string |
The value of the key attribute to be set in the registration. |
Clears the value of an attribute in the registration.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
key | string |
The name of the attribute whose value should be cleared from the registration. |
Adds a tag to the list of tags in the registration.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
tag | string |
The tag to be added to the registration. |
Removes a tag from the list of tags in the registration.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
tag | string |
The tag to be removed from the registration. |
Returns the list of tags currently set in the registration.
Kind: static method of SFMCSdk
Returns: Future<List<String>>
- A future to the list of strings representing the tags
currently set in the registration.
See
Sets the contact key for the device's user.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
contactKey | string |
The contact key to be set for the device's user. |
Returns the contact key associated with the device's user.
Kind: static method of SFMCSdk
Returns: Future<String?>
- A future to the nullable string representation of the contact key
associated with the device's user.
See
Enables verbose logging within the native Marketing Cloud SDK and Unified SFMC SDK.
Kind: static method of SFMCSdk
See
Disables verbose logging within the native Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
Instructs the native SDK to log the SDK state to the native logging system (Logcat for Android and Xcode/Console.app for iOS). This content can help diagnose most issues within the SDK and will be requested by the Marketing Cloud support team.
Kind: static method of SFMCSdk
See
This method helps to track events, which could result in actions such as an InApp Message being displayed.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
event | CustomEvent | EngagementEvent | SystemEvent | CartEvent | OrderEvent | CatalogObjectEvent |
The event to be tracked. |
Returns the deviceId used by the Marketing Cloud to send push messages to the device.
Kind: static method of SFMCSdk
Returns: Future<String?>
- A future to the device Id.
See
Enables or disables analytics in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
analyticsEnabled | boolean |
A flag indicating whether analytics should be enabled. |
Checks if analytics is enabled in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
Returns: Future<bool>
- A future to the boolean representation of whether analytics is enabled.
See
Enables or disables Predictive Intelligence analytics in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
analyticsEnabled | boolean |
A flag indicating whether PI analytics should be enabled. |
Checks if Predictive Intelligence analytics is enabled in the Marketing Cloud SDK.
Kind: static method of SFMCSdk
Returns: Future<bool>
- A future to the boolean representation of whether PI analytics is enabled.
See
Returns the list of Active, Read & Unread, not Deleted Inbox Messages.
Kind: static method of SFMCSdk
Returns: Future<List<InboxMessage>>
- A future to the InboxMessage list representing Active, Read & Unread, not Deleted Inbox Messages.
See
Returns the list of Active, Read, not Deleted Inbox Messages
Kind: static method of SFMCSdk
Returns: Future<List<InboxMessage>>
- A future to the InboxMessage list representing Active, Read, not Deleted Inbox Messages.
See
Returns the list of Active, Unread, not Deleted Inbox Messages
Kind: static method of SFMCSdk
Returns: Future<List<InboxMessage>>
- A future to the InboxMessage list representing Active, Unread, not Deleted Inbox Messages.
See
Returns the list of Active, Deleted Inbox Messages
Kind: static method of SFMCSdk
Returns: Future<List<InboxMessage>>
- A future to the InboxMessage list representing Active, Deleted Inbox Messages.
See
Returns the total number of not deleted Inbox Messages
Kind: static method of SFMCSdk
Returns: Future<int?>>
- A future to the int representing total number of not deleted Inbox Messages.
See
Returns the total number of read, not deleted Inbox Messages
Kind: static method of SFMCSdk
Returns: Future<int?>>
- A future to the int representing total number of read, not deleted Inbox Messages.
See
Returns the total number of unread, not deleted Inbox Messages
Kind: static method of SFMCSdk
Returns: Future<int?>>
- A future to the int representing total number of unread, not deleted Inbox Messages.
See
Returns the total number of deleted Inbox Messages regardless of their read status.
Kind: static method of SFMCSdk
Returns: Future<int?>>
- A future to the int representing total number of unread, not deleted Inbox Messages.
See
Marks a InboxMessage as read in local storage.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
id | String |
The InboxMessage#id() of the InboxMessage to mark as read. |
Marks a InboxMessage as deleted in local storage.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
id | String |
The InboxMessage#id() of the InboxMessage to mark as deleted. |
Marks all active, unread InboxMessages as read.
Kind: static method of SFMCSdk
Returns: Future<void>>
- A future to the void that marks all active, unread InboxMessages as read.
See
Marks all active InboxMessages as deleted.
Kind: static method of SFMCSdk
Returns: Future<void>>
- A future to the void that marks all active InboxMessages as deleted.
See
Requests an updated list of Inbox Messages from the Marketing Cloud Servers. The Inbox request can be made, at most, once per minute. This throttle also includes the Inbox request that is made by the SDK when your application is brought into the foreground.
Kind: static method of SFMCSdk
Returns: Future<bool>>
- A future to the boolean representation if inbox has been refreshed or not.
See
Call this method to be notified of Inbox events within the Marketing Cloud SDK.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
callback | InboxResponseListener |
The InboxResponseListener that you want to register. |
Unregister your InboxMessageManager.InboxResponseListener listener.
Kind: static method of SFMCSdk
See
Param | Type | Description |
---|---|---|
callback | InboxResponseListener |
The InboxResponseListener that you want to unregister. |
The InboxResponseListener is a type definition for a callback function that handles a list of InboxMessage objects. It is used to respond to events or actions that return a list of inbox messages.
Kind: typedef
Param | Type | Description |
---|---|---|
messages | List |
A list of InboxMessage objects. |
The InboxRefreshListener is a type definition for a callback function that handles the result of an inbox refresh operation. It indicates whether the refresh operation was successful or not.
Kind: typedef
Param | Type | Description |
---|---|---|
successful | bool |
A boolean value, indicating the success of the refresh operation. true if the refresh was successful, false otherwise. |
The parseMessages function takes a list of JSON strings, each representing an inbox message, and converts it into a list of InboxMessage objects.
Returns: List
- A list of InboxMessage objects.
Param | Type | Description |
---|---|---|
messages | List |
A list of JSON strings (List), where each string represents the data of an inbox message in JSON format. |
Where possible, we changed noninclusive terms to align with our company value of Equality. We retained noninclusive terms to document a third-party system, but we encourage the developer community to embrace more inclusive language. We can update the term when it’s no longer required for technical accuracy.