DownloadManager class
Manages the lifecycle and orchestration of download isolates. This class is responsible for initializing, tracking, and disposing download isolates, as well as delegating download tasks.
Constructors
- DownloadManager.new([int maxConcurrentDownloads = MAX_ISOLATE_POOL_SIZE])
-
Constructs a
DownloadIsolateManager
with an optional maximum number of concurrent downloads.
Properties
-
activeTasks
→ List<
DownloadTask> -
Returns all active (downloading) tasks.
no setter
-
allTasks
→ List<
DownloadTask> -
Returns all download tasks currently managed.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isolateSize → int
-
Returns the current number of isolates in the pool.
no setter
- poolSize → int
-
Returns the configured pool size.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
DownloadTask> -
Provides a stream of DownloadTask updates for listeners.
no setter
Methods
-
addTask(
DownloadTask task) → Future< DownloadTask> - Adds a new DownloadTask to the pool.
-
cancelTaskById(
String taskId) → void -
Cancels a task by its
taskId
. -
cancelTaskByUrl(
String url) → void - Cancels a task by its URL and removes it from the task list.
-
dispose(
) → void - Disposes the manager and releases all resources.
-
executeTask(
DownloadTask task) → Future< DownloadTask> - Executes a DownloadTask, scheduling it for download.
-
isMatchUrlExit(
String url) → bool - Checks if a task with the given match URL exists.
-
isUrlDownloading(
String url) → bool - Checks if a task with the given URL is currently downloading.
-
isUrlExit(
String url) → bool - Checks if a task with the given URL exists.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pauseAllTasks(
) → void - Pauses all active tasks.
-
pauseTaskById(
String taskId) → void -
Pauses a task by its
taskId
. -
pauseTaskByUrl(
String url) → void - Pauses a task by its URL.
-
removeAllTask(
) → void - Cancels and removes all tasks from the manager.
-
resumeTaskById(
String taskId) → void -
Resumes a task by its
taskId
. -
resumeTaskByUrl(
String url) → void - Resumes a task by its URL.
-
roundIsolate(
) → Future< void> - Triggers the isolate pool to schedule and run tasks.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited