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 In-App Messaging module in the Flutter unified plugin.
Registers a handler that decides whether the SDK should display an in-app message. This handler gives the app the final say over the native shouldShowMessage or shouldShow delegate.
1IamModule.setInAppMessageDecisionHandler(handler);| Parameter | Type | Description |
|---|---|---|
handler | InAppMessageDecisionHandler? | Invoked with the full InAppMessage to decide whether it should display. Return or complete with true to display the message, false to suppress it. Pass null to clear the handler and restore default SDK behavior, where every message shows immediately. |
Future<void>1import 'package:sfmc_iam/sfmc_iam.dart';
2
3await IamModule.requestSdk();
4IamModule.setInAppMessageDecisionHandler((message) => message.id != 'blocked-id');Displays a specific in-app message by its identifier.
1IamModule.showInAppMessage(id);| Parameter | Type | Description |
|---|---|---|
id | String | The identifier of the in-app message to display. If this value is blank or null, the API rejects the request. |
Future<void>1import 'package:sfmc_iam/sfmc_iam.dart';
2
3await IamModule.requestSdk();
4await IamModule.showInAppMessage('welcome-message');A broadcast stream of in-app message lifecycle events (shouldShow, didShow, didClose).
1IamModule.inAppMessageEvents;Stream<InAppMessageEvent> - Emits an InAppMessageEvent each time an in-app message’s lifecycle phase changes.1import 'package:sfmc_iam/sfmc_iam.dart';
2
3await IamModule.requestSdk();
4IamModule.inAppMessageEvents.listen((event) {
5 switch (event.type) {
6 case InAppMessageEventType.shouldShow:
7 // About to display: consult custom rules if needed.
8 break;
9 case InAppMessageEventType.didShow:
10 // Message is now on screen: record impression.
11 break;
12 case InAppMessageEventType.didClose:
13 // Message dismissed: record close.
14 break;
15 }
16 debugPrint('IAM ${event.type.name}: ${event.message.id}');
17});Sets the font used to render in-app messages.
1IamModule.setInAppMessageFont(fontName);| Parameter | Type | Description |
|---|---|---|
fontName | String? | The font name to apply. In Android, the name is resolved with Typeface.create. In iOS, it’s the PostScript name passed to setInAppMessageFont. Pass null to revert to the system default font. |
Future<void>1import 'package:sfmc_iam/sfmc_iam.dart';
2
3await IamModule.requestSdk();
4await IamModule.setInAppMessageFont('HelveticaNeue-Bold');Sets the status bar color of the in-app message activity. Only Android apps support this capability.
1IamModule.setStatusBarColor(colorArgb);| Parameter | Type | Description |
|---|---|---|
colorArgb | int | A 32-bit ARGB color value, such as 0xFF0000FF. |
Future<void>1import 'package:sfmc_iam/sfmc_iam.dart';
2
3await IamModule.requestSdk();
4await IamModule.setStatusBarColor(0xFF0000FF);