BackgroundDownloaderService class

Download service implementation using SmartDownloader

This is a thin wrapper around SmartDownloader to implement the DownloadService interface. All downloads benefit from SmartDownloader's HTTP-aware retry logic.

Features (provided by SmartDownloader):

  • HTTP-aware retry (401/403/404 fail after 1 attempt, others retry up to maxRetries)
  • Background downloads with resume capability
  • Progress tracking via streams
  • Network interruption recovery
  • Authentication token support
  • Works with ANY URL (HuggingFace, Google Drive, custom servers, etc.)
Implemented types

Constructors

BackgroundDownloaderService.new({FileDownloader? downloader})

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

cancel(String taskId) Future<void>
Cancels an active download
override
canResume(String taskId) Future<bool>
Checks if a download task can be resumed
override
download(String url, String targetPath, {String? token}) Future<void>
Downloads a file from URL to target path
override
downloadWithProgress(String url, String targetPath, {String? token, int maxRetries = 10}) Stream<int>
Downloads a file with progress tracking
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resume(String taskId) Future<void>
Resumes a previously interrupted download
override
toString() String
A string representation of this object.
inherited

Operators

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