The task-local stack of active journals.
How it works
The stack, not a single slot, because nested operations are real:
a transaction inside a recording may run a what-if branch, which
pushes a ReplayJournal on top. The inner branch sees its replay
journal; when it pops, the outer recording resumes.
The stack lives in a Zone — the only place in the replay module
where a Zone is used, and it is used because Dart has no task-local
storage primitive. Unlike a general "put the journal in the zone"
pattern, the stack is drained on scope exit, so a spawned task that
outlives the scope sees an empty stack and EffectJournal.current
returns NullJournal. That is the correct behaviour: a leaked task
has no journal, so its effects fail loudly.
See also:
- EffectJournal.current — reads the top of this stack.
- run, runSync — push a journal for the duration of a body.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- current → EffectJournal
-
The top of the current journal stack, or NullJournal.instance if
empty. Never returns a no-op journal that silently swallows
effects — the sentinel fails loudly, by design.
no setter
Static Methods
-
effectiveJournal(
EffectJournal captured) → EffectJournal - The journal an effectful operator should actually use: the ambient journal when an outer scope has pushed one (the ReplayEngine pushes a per-entry ReplayJournal around the dispatch), otherwise the journal the operator captured at construction.
-
run<
T> (EffectJournal journal, FutureOr< T> body()) → Future<T> -
Runs
bodywithjournalpushed on the stack. The journal is popped whenbodycompletes, whether normally or with an error. -
runSync<
T> (EffectJournal journal, T body()) → T -
The synchronous variant, for callers that know
bodyis synchronous. Pop is still guaranteed on throw.