DownloadTask constructor
DownloadTask({
- required Uri uri,
- int priority = 1,
- String? fileName,
- String cacheDir = "",
- double progress = 0.0,
- int cachedBytes = 0,
- int downloadedBytes = 0,
- int totalBytes = 0,
- DownloadStatus status = DownloadStatus.IDLE,
- int startRange = 0,
- int? endRange,
- Map<
String, Object> ? headers, - String? hlsKey,
- int retryTimes = 0,
- CancelToken? cancelToken,
Constructs a new DownloadTask with the given parameters.
uri is required. fileName is optional; if not provided, uses the URI as the file name.
Implementation
DownloadTask({
required this.uri,
this.priority = 1,
String? fileName,
this.cacheDir = "",
this.progress = 0.0,
this.cachedBytes = 0,
this.downloadedBytes = 0,
this.totalBytes = 0,
this.status = DownloadStatus.IDLE,
this.startRange = 0,
this.endRange,
this.headers,
this.hlsKey,
this.retryTimes = 0,
this.cancelToken,
}) : id = _autoId.toString(),
this.fileName = fileName ?? uri.toString() {
_autoId++;
}