Context class

Properties

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 Span attached to this Context, or a NonRecordingSpan if no such Span exists.
no setter
spanContext SpanContext
Get the SpanContext from this Context, or an invalid SpanContext if no such SpanContext exists.
no setter

Methods

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

Operators

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

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

attach(Context context, [Zone? zone]) → ContextToken
Attaches the given Context making it the active Context for the current Zone and all child Zones and returns a ContextToken that must be used to detach the Context.
createKey(String name) ContextKey
Returns a key to be used to read and/or write values to a context.
detach(ContextToken token, [Zone? zone]) bool
Detaches the Context associated with the given ContextToken from their associated Zone.