ContObserver<F, A> class sealed

Receives the outcome of a Cont computation.

ContObserver is the callback container passed to ContRunWithExtension.runWith. It holds three outcome callbacks — onCrash, onElse, and onThen — at most one of which will be invoked: exactly one when the continuation completes, none when it never completes.

Use the copyUpdate* family of methods to derive observers with selectively overridden callbacks while preserving the rest of the original observer's state.

Implementers
Available extensions

Properties

hashCode → int
The hash code for this object.
no setterinherited
onCrash → void Function(ContCrash crash)
Called when the computation terminates on the crash channel.
final
onElse → void Function(F error)
Called when the computation terminates on the else (error) channel.
final
onThen → void Function(A value)
Called when the computation succeeds on the then (value) channel.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyUpdate<F2, A2>({required void onCrash(ContCrash crash), required void onElse(F2 error), required void onThen(A2 value)}) → ContObserver<F2, A2>
Returns a copy of this observer with all three outcome callbacks replaced.
copyUpdateOnCrash(void onCrash(ContCrash crash)) → ContObserver<F, A>
Returns a copy of this observer with a replaced onCrash callback.
copyUpdateOnElse<F2>(void onElse(F2 error)) → ContObserver<F2, A>
Returns a copy of this observer with a replaced onElse callback and a new error type F2.
copyUpdateOnThen<A2>(void onThen(A2 value)) → ContObserver<F, A2>
Returns a copy of this observer with a replaced onThen callback and a new value type A2.
elseAbsurd<F>() → ContObserver<F, A>

Available on ContObserver<Never, A>, provided by the ContObserverElseNeverExtension extension

Returns a copy of this observer with the error type widened to F.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
thenAbsurd<A>() → ContObserver<F, A>

Available on ContObserver<F, Never>, provided by the ContObserverThenNeverExtension extension

Returns a copy of this observer with the success type widened to A.
toString() → String
A string representation of this object.
inherited

Operators

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