download method
Future<void>
download(
- String url,
- String targetPath, {
- String? token,
- CancelToken? cancelToken,
override
Downloads a file from URL to target path
Parameters:
url: Source URL (must be HTTP/HTTPS)targetPath: Full path where file should be savedtoken: Optional authentication tokencancelToken: Optional token for cancellation
Throws:
- DownloadException with DownloadError.network for network errors
- DownloadException with
DownloadError.fileSystemfor file write errors - DownloadCancelledException if cancelled via cancelToken
Implementation
@override
Future<void> download(
String url,
String targetPath, {
String? token,
CancelToken? cancelToken,
}) async {
// Delegate to downloadWithProgress, ignore progress events
await for (final _ in downloadWithProgress(
url,
targetPath,
token: token,
cancelToken: cancelToken,
)) {
// Ignore progress updates
}
}