awesome_task_manager library
The Awesome Task Manager is a powerful and flexible library for managing concurrent tasks in Flutter applications. It helps prevent race conditions, optimize resource usage, and provides fine-grained control over task execution.
Classes
- AwesomeTaskManager
- The main entry point and abstract interface for the Awesome Task Manager library.
-
AwesomeTaskObserver<
T> - A Flutter widget that rebuilds automatically whenever a task emits a new TaskStatus.
-
CancelableTaskStatus<
T> -
Default implementation of TaskStatus that forwards property access
directly to the underlying
TaskStateinstance. - CancelPreviousTaskManager
- LogListener
- Defines a listener interface for receiving log event notifications.
- RejectedAfterThresholdManager
- SequentialQueueManager
-
TaskFailure<
T> - Represents a failed task result.
- TaskManager
- Coordinates global task execution state and result resolution across all task managers.
- TaskPoolManager
-
TaskResult<
T> - Represents the result of a task, which can either be a success or a failure.
-
TaskStatus<
T> - Represents the public read-only status of a task execution.
-
TaskSuccess<
T> - Represents a successful task result.
Extensions
- HumanDuration on Duration
- Provides human-readable formatting utilities for Duration values.
Typedefs
-
LoadingEvent
= Future<
void> Function(Future futureToWait, {void onCancelRequested()?}) -
Defines a loading event wrapper that waits for a given
futureToWaitwhile optionally providing anonCancelRequestedcallback. -
Task<
T> = Future< T> Function(TaskStatus status) -
Represents an asynchronous unit of work that receives a read-only TaskStatus
snapshot for context and returns a result of type
T. - TaskExceptionHandler = void Function(Exception exception)
- Defines a callback invoked when a task throws an exception.
-
TaskExecution
= Future<
void> Function(String tag) - Represents a generic asynchronous execution callback used for fire-and-forget task operations.
Exceptions / Errors
- AwesomeTaskException
- Base interface for all exceptions thrown by the Awesome Task Manager.
- CancellationException
- Thrown when a task is intentionally cancelled before it completes.
- InvalidTasksParameterException
- Thrown when a task receives an invalid or unsupported parameter value.
- MismatchTasksReturnsException
- Thrown when tasks sharing the same taskId attempt to return incompatible types.
- TimeoutException
- Thrown when a task exceeds its allowed execution duration.
- TooManyTasksException
- Thrown when too many tasks are simultaneously running with the same taskId.