FileTransferHandler class abstract

A platform-independent interface for handling background file transfers.

This interface provides methods for uploading and downloading files in the background, with support for progress tracking and cancellation. The implementation handles platform-specific details for iOS and Android to ensure reliable background transfers that continue even when the app is in the background.

Features:

  • Background download and upload operations that continue when app is inactive
  • Progress tracking through Dart streams
  • Support for HTTP headers and multipart form fields
  • Transfer status notifications
  • Task cancellation

Platform-specific implementations:

  • iOS: Uses URLSession background transfer capabilities
  • Android: Uses WorkManager for reliable background processing
Implementers

Constructors

FileTransferHandler.new()

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

cancelTask(String taskId) Future<bool>
Cancels an ongoing transfer task.
configureQueue({required bool isEnabled, int maxConcurrent = 1, double cleanupDelay = 0}) Future<void>
Configure the transfer queue behavior
deleteTask(String taskId) Future<bool>
Deletes a task from the queue and cleans up associated resources. Returns true if the task was successfully deleted, false if the task wasn't found.
getDownloadProgress(String taskId) Stream<double>
Gets a stream of progress updates for a download task.
getQueuedTransfers() Future<List<Map<String, dynamic>>>
Get list of queued transfers with their details
getQueueStatus() Future<Map<String, dynamic>>
Get details about the current queue status
getUploadProgress(String taskId) Stream<double>
Gets a stream of progress updates for an upload task.
isDownloadComplete(String taskId) Future<bool>
Checks if a download task has completed successfully.
isUploadComplete(String taskId) Future<bool>
Checks if an upload task has completed successfully.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startDownload({required String fileUrl, required String savePath, Map<String, String>? headers}) Future<String>
Starts a file download operation in the background.
startUpload({required String filePath, required String uploadUrl, Map<String, String>? headers, Map<String, String>? fields}) Future<String>
Starts a file upload operation in the background.
toString() String
A string representation of this object.
inherited

Operators

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