initialize static method

Future<void> initialize(
  1. DigiaConfig config
)

Initializes the Digia SDK with the provided configuration.

Call this once at application startup — typically in main() before runApp() — and await the result before any other Digia call.

Internally this starts the real SDK services (SharedPreferences, the overlay controller) and fetches the Engage campaigns. It completes when the fetch completes, or 2 seconds after the call, whichever is first; a slower fetch keeps running in the background. The SDK is not ready until the fetch completes: a campaign triggered before that is dropped, not held. A failed fetch never throws — the SDK stays unusable until initialize is called again.

The SDK enters degraded mode if register is not subsequently called: all calls are accepted and logged, but no experiences are displayed.

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Digia.initialize(DigiaConfig(apiKey: 'prod_xxxx'));
  runApp(const MyApp());
}

Implementation

static Future<void> initialize(DigiaConfig config) {
  return SDKInstance.instance.initialize(config);
}