downloadWithProgress method

  1. @override
Stream<int> downloadWithProgress(
  1. String url,
  2. String targetPath, {
  3. String? token,
  4. int maxRetries = 10,
})
override

Downloads a file with progress tracking

Returns a stream of progress percentages (0-100)

Parameters:

  • url: Source URL
  • targetPath: Destination path
  • token: Optional auth token
  • maxRetries: Max retry attempts for transient errors (default: 10) Note: Auth errors (401/403/404) fail after 1 attempt regardless of this value

Example:

await for (final progress in downloader.downloadWithProgress(...)) {
  print('Progress: $progress%');
}

Implementation

@override
Stream<int> downloadWithProgress(
  String url,
  String targetPath, {
  String? token,
  int maxRetries = 10,
}) {
  // Delegate to SmartDownloader for all URLs
  // SmartDownloader provides HTTP-aware retry logic for ANY URL
  return SmartDownloader.downloadWithProgress(
    url: url,
    targetPath: targetPath,
    token: token,
    maxRetries: maxRetries,
  );
}