stop method

  1. @override
Future<void> stop()
override

Implementation

@override
Future<void> stop() async {
  if (!kCanTrace) {
    logger?.debug(this, 'Sentry Trace is not allowed to trace');
    return;
  }

  if (kInstance == null) {
    logger?.error(this, 'Sentry Trace is not initialized');
    return;
  }

  logger?.debug(this, 'Stopping Sentry Trace with name:$name');

  for (final entry in _metrics.entries) {
    kInstance?.setData(entry.key, entry.value);
  }

  await kInstance?.finish();

  logger?.debug(this, 'Sentry Trace:$name stopped');
}