Context class


hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
span Span?
Get the api.Span attached to this Context, or null if no such api.Span exists.
no setter
spanContext SpanContext?
Get the api.SpanContext from this Context, or null if no such api.SpanContext exists.
no setter


execute<R>(R fn()) → R
Execute a function fn within this Context and return its result.
getValue<T>(ContextKey key) → T?
Returns the value from this context identified by key, or null if no such value is set.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
setValue(ContextKey key, Object? value) Context
Returns a new context created from this one with the given key/value pair set.
toString() String
A string representation of this object.
withSpan(Span? span) Context
Returns a new Context created from this one with the given api.Span set.


operator ==(Object other) bool
The equality operator.

Static Properties

current Context
The active context.
no setter
root Context
The root context which all other contexts are derived from.
no setter

Static Methods

createKey(String name) → ContextKey
Returns a key to be used to read and/or write values to a context.