LevitTasksMixin mixin

A mixin for LevitController that adds advanced task management capabilities.

Features include:

  • Concurrency limits (queuing).
  • Task priority (TaskPriority).
  • Automatic retries with exponential backoff.

This mixin is focused on task execution and does not expose reactive state for UI consumption. See LevitReactiveTasksMixin if you need UI-specific reactive state for tasks.

Superclass constraints

Properties

hashCode int
The hash code for this object.
no setterinherited
initialized bool
Whether onInit has been executed.
no setterinherited
isClosed bool
Whether the controller is in the process of closing or is closed.
no setterinherited
isDisposed bool
Whether the controller has been disposed and closed.
no setterinherited
isInitialized bool
Whether the initialization phase is complete.
no setterinherited
maxConcurrentTasks int
The maximum number of concurrent tasks allowed.
no setter
onServiceError ↔ void Function(Object error, StackTrace stackTrace)?
Optional default error handler for all tasks run by this service.
getter/setter pair
ownerPath String
The full owner path within the monitoring system (scopeId:registrationKey).
no setterinherited
registrationKey String?
The registration key used to identify this instance in Levit.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scope LevitScope?
The LevitScope that currently owns this controller.
no setterinherited
taskCacheProvider LevitTaskCacheProvider
The cache provider used by this mixin.
no setter

Methods

autoDispose<T>(T object) → T
Registers an object to be automatically cleaned up when this controller is closed.
inherited
cancelAllTasks() → void
Cancels all running and queued tasks.
cancelTask(String id) → void
Cancels a specific task by its ID.
didAttachToScope(LevitScope scope, {String? key}) → void
Invoked when the instance is successfully attached to its owning LevitScope.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClose() → void
Callback invoked when the controller is being removed from Levit.
override
onInit() → void
Callback invoked after the controller is instantiated and registered.
override
runIsolateTask<T>(FutureOr<T> task(), {String? id, TaskPriority priority = TaskPriority.normal, int retries = 0, Duration? retryDelay, bool useExponentialBackoff = true, void onError(Object error, StackTrace stackTrace)?, TaskCachePolicy<T>? cachePolicy, String? debugName}) Future<T?>
Executes a task in a separate Isolate using Isolate.run.
runTask<T>(Future<T> task(), {String? id, TaskPriority priority = TaskPriority.normal, int retries = 0, Duration? retryDelay, bool useExponentialBackoff = true, void onError(Object error, StackTrace stackTrace)?, TaskCachePolicy<T>? cachePolicy}) Future<T?>
Executes an asynchronous task with optional retry and priority logic.
toString() String
A string representation of this object.
inherited

Operators

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