Flutter Advanced Features

Learn more about advanced features such as Product Config, Feature Flags, Native Display, and more.

Advanced Features

Debugging

During development, we recommend that you set the SDK to DEBUG mode, in order to log warnings or other important messages to the iOS logging system. This can be done by setting the debug level.

Set Debug Level

Can be one of the following:

  • -1: disables all debugging
  • 0 : default, shows minimal SDK integration related logging
  • 1 : shows debug output
  • 3 : shows verbose output
CleverTapPlugin.setDebugLevel(3);

If you want to disable CleverTap logs for production environment, you can set the debug level to 0 which is already set by default.

Push Notifications

Registering FCM, Baidu, Xiaomi, or Huawei Token

CleverTap supports integration with various 3rd party push providers for Android platform

  • To enable automatic integration with Various providers via CleverTap , integrate the associated clevertap service in Android module of your code by following the Android push guide
  • To enable manual integration with various 3rd party push providers, You can integrate them via their associated implementation guides and use the Flutter plugin's built in methods to send Push token to CT server:
CleverTapPlugin.setPushToken(“value”);
CleverTapPlugin.setBaiduPushToken(“value”);
CleverTapPlugin.setXiaomiPushToken(“value”);
CleverTapPlugin.setHuaweiPushToken(“value”);

Create Notification

CleverTapPlugin.createNotification(data);

Custom Handling for Enhanced Push Delivery

Process Push Notification

CleverTapPlugin.processPushNotification(data);

Native Display

Native Display helps to display content natively within your app without interrupting the user. It also provides the ability to change the content of your app dynamically and deliver relevant and contextual content to your users.

On Display Units Loaded

void onDisplayUnitsLoaded(List<dynamic> displayUnits) {
    this.setState(() async {
      List displayUnits = await CleverTapPlugin.getAllDisplayUnits();
      print("Display Units = " + displayUnits.toString());
   });
}

Get All Display Units

void onDisplayUnitsLoaded(List<dynamic> displayUnits) {
    this.setState(() async {
      List displayUnits = await CleverTapPlugin.getAllDisplayUnits();
      print("Display Units = " + displayUnits.toString());
   });
}

Display unit viewed event for ID

CleverTapPlugin.pushDisplayUnitViewedEvent(“unitId”);

Display unit clicked event for ID

CleverTapPlugin.pushDisplayUnitClickedEvent(“unitId”);

Product Config

With Product Experiences, you can change the behavior and appearance of your app remotely without an update. This helps you to deliver in-app personalization experience to your app users and test their response. You can use product config to modify app behaviour and feature flags to add or remove features from your app without performing an app store deployment.

Set Product Configuration to default

You can set in-app default parameter values in the Product Config object so that your app behaves as intended before values are fetched from CleverTap, and so that default values are available if none are set on the dashboard.

void productConfigInitialized() {
    print("Product Config Initialized");
    this.setState(() async {
      await CleverTapPlugin.fetch();
    });
}

Fetch and activate values

To fetch parameter values from CleverTap, call the fetch() method. Any values that you set on the dashboard are fetched and stored in the Product Config object.
To make fetched parameter values available to your app, call the activate() method.

For cases where you want to fetch and activate values in one call, you can use a fetchAndActivate()request to fetch values from CleverTap and make them available to the app:

Fetching product configs

By default, the fetch calls are throttled, which is controlled from the CleverTap servers as well as SDK. To know more see the Throttling section. The default value for minimum fetch interval is set at 60*10 by default from CleverTap.

void fetch() {
    CleverTapPlugin.fetch();
    // CleverTapPlugin.fetchWithMinimumIntervalInSeconds(60*10);
}

Activate the most recently fetched product config

void activate() {
    CleverTapPlugin.activate();
}

Fetch And Activate product config

void fetchAndActivate() {
    CleverTapPlugin.fetchAndActivate();
 }

Fetch Minimum Time Interval

CleverTapPlugin.setMinimumFetchIntervalInSeconds(interval);

Get Boolean key

CleverTapPlugin.getProductConfigBoolean(“key”);

Get String key

CleverTapPlugin.getProductConfigString("StringKey");

Get Long key

CleverTapPlugin.getProductConfigLong("IntKey");

Get Double key

CleverTapPlugin.getProductConfigDouble("DoubleKey");

Get last fetched timestamp in milliseconds

CleverTapPlugin.getLastFetchTimeStampInMillis();

Feature Flag

Feature flags let you toggle a feature on and off controlled via CleverTap Backend.

Get Feature Flag

Feature flags are automatically fetched every time a new app session is created. Once the flags are fetched you can get it via the getters.

void featureFlagsUpdated() {
    this.setState(() async {
      bool booleanVar = await CleverTapPlugin.getFeatureFlag("BoolKey", false);
   });
}

App Personalization

Enable Personalization

CleverTapPlugin.enablePersonalization();

Disable Personalization

CleverTapPlugin.disablePersonalization();

Attributions

Push Install Referrer

CleverTapPlugin.pushInstallReferrer("source", "medium", "campaign");

GDPR

Set Opt Out

CleverTapPlugin.setOptOut(false); ///Will opt in the user to send data to CleverTap
CleverTapPlugin.setOptOut(true); ///Will opt out the user to send data to CleverTap

Enable Device Networking Info Reporting

// Will opt out the user to send Device Network data to CleverTap
CleverTapPlugin.enableDeviceNetworkInfoReporting(false);
// Will opt in the user to send Device Network data to CleverTap
CleverTapPlugin.enableDeviceNetworkInfoReporting(true);

Set Offline

// Will set the user online
CleverTapPlugin.setOffline(false);
// Will set the user offline
CleverTapPlugin.setOffline(true);

What’s Next
Did this page help you?