Advanced
The following guides cover advanced features and customization options available in the Actito SDK.
These topics are optional and can be adopted selectively based on your application’s requirements. You can safely skip any sections that are not relevant to your use case or implementation strategy.
Lifecycle
When using the In-app Messages module to present in-app messages, you can listen to a series of lifecycle events emitted during the presentation process. In more advanced implementations, these events can be leveraged to execute additional logic — such as tracking analytics, updating application state, or triggering custom navigation behaviors.
To do so, listen to the following events:
ActitoInAppMessaging.onMessagePresented.listen((message) { });
ActitoInAppMessaging.onMessageFinishedPresenting.listen((message) { });
ActitoInAppMessaging.onMessageFailedToPresent.listen((message) { });
ActitoInAppMessaging.onActionExecuted.listen((data) { });
ActitoInAppMessaging.onActionFailedToExecute.listen((data) { });
Presentation events
These methods notify you of each stage in an in-app message’s presentation lifecycle:
onMessagePresented: Called right after the in-app message is presented.
ActitoInAppMessaging.onMessagePresented((message) => {
console.log(`In-app message presented`);
});
onMessageFinishedPresenting: Called when the in-app message has been dismissed or closed.
ActitoInAppMessaging.onMessageFinishedPresenting((message) => {
console.log(`In-app message finished presenting`);
});
onMessageFailedToPresent: Called if an error occurs during presentation.
ActitoInAppMessaging.onMessageFailedToPresent((message) => {
console.log(`In-app message failed to present`);
});
Action events
These methods notify you of each stage in an action’s execution lifecycle:
onActionExecuted: Called when the action has been successfully performed.
ActitoInAppMessaging.onActionExecuted((data) => {
console.log(`Action executed`);
});
onActionFailedToExecute: Called when the SDK attempted to execute the action but encountered an error.
ActitoInAppMessaging.onActionFailedToExecute((data) => {
console.log(`Action failed to execute`);
});