getSpan method

ISentrySpan? getSpan()

Gets the current active transaction or span.

Implementation

ISentrySpan? getSpan() {
  ISentrySpan? span;
  if (!_isEnabled) {
    _options.logger(
      SentryLevel.warning,
      "Instance is disabled and this 'getSpan' call is a no-op.",
    );
  } else if (!_options.isTracingEnabled()) {
    _options.logger(
      SentryLevel.info,
      "Tracing is disabled and this 'getSpan' returns null.",
    );
  } else {
    final item = _peek();

    span = item.scope.span;
  }

  return span;
}