The Mapp Engage Flutter plugin uses static callback properties to deliver certain SDK events back to your Flutter application. This is especially important for push interactions, in-app messaging, inbox delivery, deep linking, and custom link handling.
How callbacks work
Callbacks are assigned directly on MappSdk as static properties. When the corresponding SDK event occurs, the assigned handler is invoked with the event payload.
MappSdk.handledPushOpen = (dynamic arguments) {
print('Push opened: $arguments');
};Because some events may occur early in the application lifecycle, assign callback handlers before calling engage().
Assign callbacks before initialization
To avoid missing early events, define the required callback handlers before initializing the SDK.
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
MappSdk.handledRemoteNotification = (dynamic arguments) {
print('Push received: $arguments');
};
MappSdk.handledPushOpen = (dynamic arguments) {
print('Push opened: $arguments');
};
await MappSdk.engage(
'YOUR_SDK_KEY',
'YOUR_GOOGLE_PROJECT_ID',
SERVER.L3,
'YOUR_APP_ID',
'YOUR_TENANT_ID',
);
runApp(MyApp());
}Push callbacks
Use these callbacks to react to incoming push notifications and user interactions.
MappSdk.handledRemoteNotification = (dynamic arguments) {
// Fired when a push notification is received
};
MappSdk.handledPushOpen = (dynamic arguments) {
// Fired when the user taps a notification
};
MappSdk.handledPushDismiss = (dynamic arguments) {
// Fired when a notification is dismissed
};
MappSdk.handledPushSilent = (dynamic arguments) {
// Fired for silent or data-only pushes
};
MappSdk.handledRichContent = (dynamic arguments) {
// Fired when rich push media is available
};Callback | Platform | Description |
|---|---|---|
| Android, iOS | Triggered when a push notification is received. |
| Android, iOS | Triggered when the user opens a notification. |
| Android | Triggered when a notification is dismissed without being opened. |
| Android | Triggered for silent or data-only push delivery. |
| Android, iOS | Triggered when rich push media becomes available. |
In-app and inbox callbacks
Use these callbacks when your app relies on event-driven in-app messaging or inbox delivery.
MappSdk.didReceiveInappMessageWithIdentifier = (dynamic arguments) {
// Fired when an in-app message is ready to display
};
MappSdk.didReceiveInBoxMessage = (dynamic arguments) {
// Fired with a single inbox message result
};
MappSdk.didReceiveInBoxMessages = (dynamic arguments) {
// Fired with all inbox messages
};
MappSdk.inAppCallFailedWithResponse = (dynamic arguments) {
// Fired when an in-app API call fails
};Callback | Platform | Description |
|---|---|---|
| Android, iOS | Triggered when an in-app message is ready to display. |
| iOS | Triggered when a single inbox message is delivered. |
| iOS | Triggered when multiple inbox messages are delivered. |
| Android, iOS | Triggered when an in-app API call fails. |
Deep link and custom link callbacks
Use these callbacks to respond to link actions delivered by push notifications or in-app messaging.
MappSdk.didReceiveDeepLinkWithIdentifier = (dynamic arguments) {
final String url = arguments.toString();
// Parse and route the URL in your app
};
MappSdk.didReceiveCustomLinkWithIdentifier = (dynamic arguments) {
// Handle a custom link action
};Callback | Platform | Description |
|---|---|---|
| Android, iOS | Triggered when a deep link is received. |
| Android, iOS | Triggered when a custom link action is received. |
Working with callback payloads
Callback payloads are passed as dynamic. Parse them according to your application needs.
Read push payload data
Handle deep links
Update UI state
Log message interactions
Platform differences
handledPushDismissis Android-onlyhandledPushSilentis Android-onlyInbox delivery on iOS is event-based
Best practices
Assign callbacks before initialization
Keep handlers lightweight
Use a central navigation layer for routing
Handle platform differences explicitly