UploadManager class

The core management engine for resilient, persistent, offline-tolerant file uploads.

Constructors

UploadManager({QueueStorage? storage, ConnectivityMonitor? connectivityMonitor, RetryPolicy? retryPolicy, int maxConcurrentUploads = 2, HeaderProvider? headerProvider, NotificationConfig notificationConfig = const NotificationConfig()})

Properties

allTasks → List<UploadTask>
All tasks currently in the queue.
no setter
connectivityMonitor → ConnectivityMonitor
final
hashCode → int
The hash code for this object.
no setterinherited
headerProvider → HeaderProvider?
final
maxConcurrentUploads → int
final
notificationManager → UploadNotificationManager
final
progressStream → Stream<UploadTask>
Stream emitting real-time progress updates for individual tasks.
no setter
queueSummaryStream → Stream<QueueSummary>
Stream emitting aggregate queue summary metrics.
no setter
retryPolicy → RetryPolicy
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
storage → QueueStorage
final
summary → QueueSummary
Current queue summary snapshot.
no setter
taskStatusStream → Stream<UploadTask>
Stream emitting task lifecycle state changes.
no setter

Methods

add({String? filePath, List<String>? filePaths, required String url, String method = 'POST', Map<String, String> headers = const {}, Map<String, dynamic> data = const {}, String fileFieldName = 'file', TaskPriority priority = TaskPriority.normal, String? tag, Map<String, dynamic> metadata = const {}, UploadProtocol protocol = UploadProtocol.standard, String? customAdapterId, String? adapterType, int? maxRetries, int? simulatedFileSize, TaskProgressCallback? onProgress, TaskStatusCallback? onSuccess, TaskErrorCallback? onError}) → Future<UploadTask>
Adds a new file upload task to the queue and starts processing.
addMultiple({required List<String> filePaths, required String url, String method = 'POST', Map<String, String> headers = const {}, Map<String, dynamic> data = const {}, String fileFieldName = 'files', TaskPriority priority = TaskPriority.normal, String? tag, Map<String, dynamic> metadata = const {}, UploadProtocol protocol = UploadProtocol.standard, String? customAdapterId, String? adapterType, int? maxRetries, int? simulatedFileSize, TaskProgressCallback? onProgress, TaskStatusCallback? onSuccess, TaskErrorCallback? onError}) → Future<UploadTask>
Adds an upload task containing multiple files in a single HTTP multipart request.
cancel(String taskId) → Future<void>
Cancels an upload task and marks it as cancelled.
cancelAll() → Future<void>
Cancels all active and pending tasks.
clearCompleted() → Future<void>
Removes all completed and cancelled tasks from memory and storage.
deleteTask(String taskId) → Future<void>
Deletes a task from the queue and persistent storage.
dispose() → Future<void>
Closes the manager and releases streams, adapters, and listeners.
getTask(String id) → UploadTask?
Retrieves a task by id.
init() → Future<void>
Initializes storage, restores tasks, checks connectivity, and starts processing.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause(String taskId) → Future<void>
Pauses an active or enqueued task.
pauseAll() → Future<void>
Pauses all active and enqueued tasks.
registerAdapter(UploadAdapter adapter) → void
Registers a custom upload transport adapter.
resume(String taskId) → Future<void>
Resumes a paused or failed task.
resumeAll() → Future<void>
Resumes all paused and failed tasks.
retry(String taskId) → Future<void>
Retries a failed or cancelled task immediately.
retryAllFailed() → Future<void>
Retries all currently failed tasks.
toString() → String
A string representation of this object.
inherited
totalBytesOrFallback(int total, int uploaded) → int
watch(String taskId) → Stream<UploadTask>
Watches a specific task's lifecycle and progress updates.

Operators

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