EffectContext<E extends Object> class abstract interface

The capabilities available inside Effect.result.

The context is deliberately read-only: code can observe cooperative cancellation, resolve services, compose Results and Effects, fail with a typed error, read Effect locals, and acquire scoped resources. It cannot mutate the Module or the DI backend.

Properties

cancellation → CancellationSignal
Observe cooperative cancellation requested by Runtime shutdown.
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

acquire<R extends Object, F extends E>(Effect<R, F> acquisition, {required ResourceRelease<R> release}) → Future<R>
Acquire a resource and register its outcome-aware release callback in the current Scope.
call<T extends Object>([ServiceKey<T>? key]) → T
Resolve a dependency at the point where the code uses it.
fail<F extends E>(F error) → Never
Stop the current Effect with an expected, typed failure.
local<T extends Object>(EffectLocal<T> local) → T
Read the current value of an EffectLocal.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
result<A extends Object, F extends E>(FutureOr<ResultDart<A, F>> source) → Future<A>
Unwrap a synchronous or asynchronous Result and propagate its failure.
service<T extends Object>([ServiceKey<T>? key]) → T
Named equivalent of call for autocomplete and discoverability.
toString() → String
A string representation of this object.
inherited
tryAsync<A extends Object, F extends E>(FutureOr<A> operation(), {required F onError(Exception error, StackTrace stackTrace)}) → Future<A>
Convert a synchronous or asynchronous operation that throws Exception into a typed failure.
unwrap<A extends Object, F extends E>(Effect<A, F> effect) → Future<A>
Run another Effect in the same environment and propagate its failure.

Operators

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