digia_engage_clevertap

pub.dev

CleverTap CEP plugin for the Digia Flutter SDK. Bridges CleverTap in-app messages and native display units into Digia's server-driven UI rendering engine.

Features

  • Auto-registers the digia 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 (inline banners) to DigiaSlot placements.
  • CleverTapPlugin.registerTemplate() — explicit Dart-triggered registration (idempotent; native auto-registration still takes precedence).
  • CleverTapPlugin.syncCustomTemplates() — debug helper for pushing template definitions to the CleverTap dashboard.

Installation

dependencies:
  digia_engage: ^1.1.0
  digia_engage_clevertap: ^1.1.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(CleverTapPlugin());

  runApp(const MyApp());
}

Android

No additional setup required. The plugin uses a ContentProvider to register the digia 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)
  }
}

Rendering inline campaigns with DigiaSlot

DigiaSlot (exported by digia_engage) renders CleverTap display-unit campaigns inline at a named placement. The placement key must match the key configured on the Digia / CleverTap dashboard.

import 'package:digia_engage/digia_engage.dart';

// Self-sizing (recommended)
DigiaSlot('hero_banner')

// With an explicit height
SizedBox(
  height: 200,
  child: DigiaSlot('hero_banner'),
)

// With a placeholder while no campaign is active
DigiaSlot(
  'mid_banner',
  placeholder: const SizedBox.shrink(),
)

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 CleverTapPlugin.syncCustomTemplates();

Follow the console output for instructions on marking the test profile so the dashboard accepts the sync.

📄 License

This project is licensed under the Business Source License 1.1 (BSL 1.1) - see the LICENSE file for details. The BSL 1.1 allows personal and commercial use with certain restrictions around competing platforms. On March 18, 2030, the license will automatically convert to Apache License 2.0.

For commercial licensing inquiries or exceptions, please contact admin@digia.tech.


Built with ❤️ by the Digia team