DownloadTask constructor

DownloadTask({
  1. required Uri uri,
  2. int priority = 1,
  3. String? fileName,
  4. String cacheDir = "",
  5. double progress = 0.0,
  6. int cachedBytes = 0,
  7. int downloadedBytes = 0,
  8. int totalBytes = 0,
  9. DownloadStatus status = DownloadStatus.IDLE,
  10. int startRange = 0,
  11. int? endRange,
  12. Map<String, Object>? headers,
  13. String? hlsKey,
  14. int retryTimes = 0,
  15. 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++;
}