QueueItem class
Represents a single item in the download queue managed by DownloadManager.
Each QueueItem contains the download url, an optional fileName, and an optional progressCallback to receive updates on the progress of the download.
If progressCallback is provided, it will be invoked with a Stream<double>
that emits values between 0.0
(0%) and 1.0
(100%) as the download progresses.
Example:
QueueItem(
url: 'https://example.com/file.zip',
fileName: 'example.zip', // optional
progressCallback: (stream) {
stream.listen((progress) {
print('Progress: ${(progress * 100).toStringAsFixed(1)}%');
});
},
);
Constructors
- QueueItem.new({required String url, String? fileName, void progressCallback(DownloadProgress progress)?})
-
Creates a new QueueItem with the specified
url
, an optionalfileName
, and optionalprogressCallback
. iffileName
is not provided, the original URL is used.
Properties
- fileName → String?
-
An optional filename for the downloaded file. If not provided, the original URL is used.
final
- fileNameUrl → String
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- progressCallback → void Function(DownloadProgress progress)?
-
An optional callback to receive a stream of download progress updates.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → String
-
The full URL of the file to be downloaded.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited