init static method
Runtime init (backward-compat / consent-gated / white-label path).
Prefer native auto-init (config in AndroidManifest / Info.plist). Use this only when you don't want the credentials in the native files — e.g. you must defer init until after a privacy-consent prompt, or pick the writeKey at runtime. Native auto-init must be disabled (no writeKey in the native files, or Lemnisk.AUTO_INIT=false) for this to own initialization.
Sends a single friendly-key config object; the native SDK maps the keys.
Implementation
static Future<void> init({
required String writeKeyAndroid,
required String writeKeyIOS,
required String serverUrl,
String? consentUrl,
String? notificationCenterUrl,
bool? enablePush,
bool? enablePullNotifications,
bool? enableAnalytics,
bool? enableInApp,
bool? enableDebugMode,
}) async {
final writeKey =
defaultTargetPlatform == TargetPlatform.iOS ? writeKeyIOS : writeKeyAndroid;
final config = <String, dynamic>{
'writeKey': writeKey,
'serverUrl': serverUrl,
};
if (consentUrl != null) config['consentUrl'] = consentUrl;
if (notificationCenterUrl != null) {
config['notificationCenterUrl'] = notificationCenterUrl;
}
if (enablePush != null) config['enablePush'] = enablePush;
if (enablePullNotifications != null) {
config['enablePullNotifications'] = enablePullNotifications;
}
if (enableAnalytics != null) config['enableAnalytics'] = enableAnalytics;
if (enableInApp != null) config['enableInApp'] = enableInApp;
if (enableDebugMode != null) config['enableDebugMode'] = enableDebugMode;
await methodChannel.invokeMethod('init', config);
}