current property

TraceContext? get current

The context for the request currently being handled, if any.

Null outside a request — a background timer, a startup hook, or a Router used without going through runWith.

Implementation

static TraceContext? get current {
  final value = Zone.current[zoneKey];

  return value is TraceContext ? value : null;
}