initialize method
Future<void>
initialize(
{ - bool autoStart = true,
- bool canTrace = false,
})
override
Implementation
@override
Future<void> initialize({
bool autoStart = true,
bool canTrace = false,
}) async {
logger = await LittleFishCore.instance.getServiceFromList<LoggerService>();
kCanTrace = canTrace;
logger?.debug(this, 'Initializing Sentry Trace');
if (!canTrace) {
logger?.debug(
this,
'Sentry Trace is not allowed to trace, '
'please enable it in the settings if required');
return;
}
if (!Sentry.isEnabled) {
logger?.warning(this, 'Sentry is not initialized, trace will not work');
kCanTrace = false;
return;
}
kInstance = Sentry.startTransaction(
name,
operation,
bindToScope: true,
autoFinishAfter: null,
);
logger?.debug(this, 'Sentry Trace initialized');
if (autoStart) {
await start();
}
logger?.debug(this, 'Sentry Trace:$name is ready');
}