Flutter In-App

Learn how to handle in-app notifications in Flutter.

In-App Notifications

In-app notifications are pop-ups that you can show to your users while in your application.

In-App Notification Button onClick callback

To handle on In-App Button click, add the following code snippet:

_clevertapPlugin.setCleverTapInAppNotificationButtonClickedHandler(inAppNotificationButtonClicked);

void inAppNotificationButtonClicked(Map<String, dynamic> map) {
    this.setState(() {
      print("inAppNotificationButtonClicked called = ${map.toString()}");
    });
}

In-App Notification Button onDismissed callback

To handle on Dismissed callback:

_clevertapPlugin.setCleverTapInAppNotificationDismissedHandler(inAppNotificationDismissed)

void inAppNotificationDismissed(Map<String, dynamic> map) {
    this.setState(() {
      print("inAppNotificationDismissed called");
    });
}

Control In-App Notifications

Suspend

Suspends and saves in-app notifications until resumeInAppNotifications method is called for the current session.

CleverTapPlugin.suspendInAppNotifications();

Discard

Suspends the display of in-app Notifications and discards any new in-app notification.
In-app notifications are discarded until the resumeInAppNotifications method is called for the current session.

CleverTapPlugin.discardInAppNotifications();

Resume

The resumeInAppNotifications method resumes displaying in-app notifications.

If you call this method after the discardInAppNotifications() method, it resumes the in-app notifications for events raised after the call is performed.

However, if you call the resumeInAppNotifications method after the suspendInAppNotifications() method, then it displays all queued in-app notifications and also resumes in-app notifications for events raised after the call is performed.

CleverTapPlugin.resumeInAppNotifications();

Did this page help you?