Flutter Advanced Features

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

Advanced Features

Debugging

Set Debug Level

CleverTapPlugin.setDebugLevel(3);

Push Notifications

Registering FCM, Baidu, Xiaomi, or Huawei Token

CleverTapPlugin.setPushToken(“value”);
CleverTapPlugin.setBaiduPushToken(“value”);
CleverTapPlugin.setXiaomiPushToken(“value”);
CleverTapPlugin.setHuaweiPushToken(“value”);

Create Notification

CleverTapPlugin.createNotification(data);

Custom Push Amplification

Process Push Notification

CleverTapPlugin.processPushNotification(data);

Native Display

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

Set Product Configuration to default

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

Fetching product configs

void fetch() {
    CleverTapPlugin.fetch();
    // CleverTapPlugin.fetchWithMinimumIntervalInSeconds(0);
}

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

Get Feature Flag

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?