digia_engage_clevertap

pub.dev

CleverTap CEP plugin for the Digia Flutter SDK. Bridges CleverTap custom template campaigns and native display units into Digia's server-driven UI rendering engine.

Features

  • Auto-registers the DigiaTemplate custom in-app template on Android (via ContentProvider, no Application.onCreate override needed) and iOS (via FlutterPlugin registration).
  • Routes CleverTap custom template present/close events to the Digia rendering pipeline.
  • Routes CleverTap display units to Digia campaign triggers.
  • DigiaCleverTapPlugin.registerTemplate() — explicit Dart-triggered registration (idempotent; native auto-registration still takes precedence).
  • DigiaCleverTapPlugin.syncCustomTemplates() — debug helper for pushing template definitions to the CleverTap dashboard.

Template

The DigiaTemplate custom template has exactly two arguments:

Argument Type Default
digia_campaign_key string ""
variables string "{}"

Installation

dependencies:
  digia_engage: ^1.5.0
  digia_engage_clevertap: ^1.2.0

Setup

Dart

import 'package:digia_engage_clevertap/digia_engage_clevertap.dart';
import 'package:digia_engage/digia_engage.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Digia.initialize(
    DigiaConfig(apiKey: 'YOUR_DIGIA_API_KEY'),
  );

  // Register the CleverTap plugin — template registration is automatic.
  Digia.register(DigiaCleverTapPlugin());

  runApp(const MyApp());
}

Android

No additional setup required. The plugin uses a ContentProvider to register the DigiaTemplate custom template before the Flutter engine starts.

iOS

Template registration happens automatically during GeneratedPluginRegistrant.register(with:).

If you use manual CleverTap initialisation (i.e. you call CleverTap.autoIntegrate() yourself), add the following to AppDelegate.application(_:didFinishLaunchingWithOptions:) before CleverTap.autoIntegrate():

// AppDelegate.swift
import clevertap_plugin

@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    // Register Digia template before CleverTap auto-integrates.
    CleverTapPluginCustomTemplates.registerCustomTemplates("DigiaTemplate")

    GeneratedPluginRegistrant.register(with: self)
    CleverTap.autoIntegrate()
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Syncing templates to the dashboard (debug only)

After registering the plugin, call syncCustomTemplates() once while running in debug mode with a CleverTap test profile active:

// Debug builds only — remove before shipping to production.
await DigiaCleverTapPlugin.syncCustomTemplates();

📄 License

This project is licensed under the Business Source License 1.1 (BSL 1.1) - see the LICENSE file for details.


Built with ❤️ by the Digia team