CausalityContext class

Metadata carried through Dart Zones across async boundaries.

When CausalityZone.run forks a new Zone, this context is injected as a Zone value. Any code running inside that Zone (including code after await boundaries) can read it via CausalityZone.currentContext.

This is the mechanism that links a user tap to the network call it triggers to the state change that results, without requiring developers to manually pass context objects through every function call.

Constructors

CausalityContext({required String eventId, String? parentEventId, required String originDescription, required DateTime timestamp})
const

Properties

eventId String
Unique ID for this causal origin event.
final
hashCode int
The hash code for this object.
no setterinherited
originDescription String
Human-readable description of what initiated this causal chain. Examples: "user_tapped_login", "timer_refresh", "push_notification".
final
parentEventId String?
The parent event's ID, if this context was created inside an existing CausalityZone.run call. Forms the parent edge in the CausalGraph.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp DateTime
When this causal chain started.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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