initialize static method
Initializes Tealium with a TealiumConfig object
Future<bool> upon success or failure
Implementation
static Future<bool> initialize(TealiumConfig config) async {
if (config.dispatchers
.toString()
.contains(Dispatchers.RemoteCommands.toString())) {
_handleListener(EventListenerNames.remoteCommand);
}
config.remoteCommands?.forEach((command) {
var callback = command.callback;
if (callback != null) {
_addRemoteCommandListener(command.id, callback);
}
});
var initialized = await _channel.invokeMethod('initialize', {
'account': config.account,
'profile': config.profile,
'environment': config.environment,
'collectors': config.collectors,
'dispatchers': config.dispatchers,
'dataSource': config.dataSource,
'customVisitorId': config.customVisitorId,
'memoryReportingEnabled': config.memoryReportingEnabled,
'overrideCollectURL': config.overrideCollectURL,
'overrideCollectProfile': config.overrideCollectProfile,
'overrideCollectBatchURL': config.overrideCollectBatchURL,
'overrideCollectDomain': config.overrideCollectDomain,
'overrideLibrarySettingsURL': config.overrideLibrarySettingsURL,
'overrideTagManagementURL': config.overrideTagManagementURL,
'deepLinkTrackingEnabled': config.deepLinkTrackingEnabled,
'qrTraceEnabled': config.qrTraceEnabled,
'logLevel': config.logLevel,
'consentLoggingEnabled': config.consentLoggingEnabled,
'consentPolicy': config.consentPolicy,
'consentExpiry': config.consentExpiry,
'batchingEnabled': config.batchingEnabled,
'lifecycleAutotrackingEnabled': config.lifecycleAutotrackingEnabled,
'useRemoteLibrarySettings': config.useRemoteLibrarySettings,
'visitorServiceEnabled': config.visitorServiceEnabled,
'sessionCountingEnabled': config.sessionCountingEnabled,
'test': "test",
'remoteCommands': config.remoteCommands?.map((e) => {
"id": e.id,
"url": e.url,
"path": e.path
}).toList(),
'visitorIdentityKey': config.visitorIdentityKey
});
if (initialized) {
addToDataLayer(
{'plugin_name': plugin_name, 'plugin_version': plugin_version},
Expiry.forever);
}
return initialized;
}