Skip to main content
Self-handled cards give you the flexibility of creating Card Campaigns on the MoEngage Platform and displaying the cards anywhere inside the application. SDK provides APIs to fetch the campaign’s data using which you can create your own view for cards. Download

SDK Installation

Installation

To add MoEngage Cards SDK to your application, edit the application’s pubspec.yaml file and add the below dependency to it:
$latestVersion refers to the latest version of the plugin. Post including the dependency, run flutter pub get command in the terminal to install the dependency. After installing the plugin, use the following platform-specific configuration.
This plugin is dependent on moengage_flutter plugin. Make sure you have installed the moengage_flutter plugin as well. Refer to the documentation for the same.

Android Installation

V(1) Add the following dependency in the app/build.gradle file.
replace $sdkVersion with the appropriate SDK version. Minimum supported version 1.5.0.

iOS Installation

In the case of iOS, the native dependency is part of the Cards flutter SDK itself, so there is no need to include any additional dependency for supporting Cards.

Initialize Cards

MoEngage Cards module can be initialized in the widget where the cards module is being used. 
Example

Get Cards Info

Fetch All the cards campaign data that are eligible to show for the particular user which returns data as CardsInfo. For a complete list of data models please refer to the API documentation.

Widget and Widget Id Mapping

Basic Card/Illustration Card

Refresh Cards

Use the refreshCards*()*** API to refresh cards on the User Demand. This API can be used to mimic Pull to refresh behavior.

Fetch Cards

Use the fetchCards*()*** API to fetch cards for the User. This API can be used to sync latest cards data.
For details on the sync timing and rate limits for fetchCards(), see When Does the MoEngage SDK Sync Card Data?

Inbox Loaded

You can show the cards on a separate screen or a section of the screen. When the cards screen/section is loaded call onCardsSectionLoaded().

Inbox UnLoaded

Call onCardSectionUnloaded() when the screen/section is no longer visible or going to the background.

Fetch Categories

To fetch all the categories for which cards are configured, use the getCardsCategories() API.

All Cards Categories Enabled

To fetch all the categories for which cards are configured, use the isAllCategoryEnabled() API.

Fetch Cards for Categories

To fetch cards eligible for display for a specific category use the getCardsForCategory() API.

Get New Cards Count

To obtain the new cards count use getNewCardsCount() method as shown below:

Card Shown

Call the cardShown() API to notify a card is shown to the user.

Card Clicked

Call the cardClicked() API to notify a card is shown to the user.

Delete Card

Call the deleteCard() API to delete a card.

Mark Card Delivered

To track delivery to the card section of the application call the cardDelivered() API when the cards section of the application is loaded.

Delete Multiple Cards

Call the deleteCards() API to delete a card.

Get Unclicked Cards Count

To obtain the unclicked cards count use getUnClickedCardsCount() method as shown below.

App Open Card Sync Listener

Set this listener to get a callback for card sync on the App opened. This listener should be set before calling initialize() API. In most cases, this API is not required.
The hybrid framework does not support the MoEngage default Card. Only the Self-handled Card is supported.