ZenithConcurrencyRunner class
A concurrency runner that supports the restartable pattern via explicit
ZenithCancellationTokens.
Unlike ZenithConcurrencyX.runAsyncGuarded (which uses generation counters
and AsyncValue nodes), ZenithConcurrencyRunner works with arbitrary
Future<void> tasks and physically cancels the prior token.
final runner = ZenithConcurrencyRunner();
runner.runAsyncRestartable((token) async {
token.onCancel(() => client.abort());
await client.search(query);
});
Constructors
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
-
cancelCurrent(
) → void - Cancels the currently active task, if any.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runAsyncRestartable(
Future< void> task(ZenithCancellationToken token)) → void -
Runs
taskwith a fresh ZenithCancellationToken, cancelling any previously active task's token before starting. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited