saveNetwork abstract method
Stream<SaveProgress>
saveNetwork({
- required String url,
- required String fileName,
- required FileType fileType,
- Map<
String, String> ? headers, - Duration timeout = const Duration(seconds: 60),
- SaveLocation? saveLocation,
- String? subDir,
- ConflictResolution conflictResolution = ConflictResolution.autoRename,
Downloads from url and saves to device storage with progress streaming.
Platforms: Android · iOS · macOS · Windows · Linux · Web
Downloaded natively to avoid double storage:
-
Android: streams directly to MediaStore (zero temp files)
-
iOS Documents: downloads directly to target path
-
iOS Photos: temp → Photos Library → delete temp
-
headers: Optional HTTP headers for the request -
timeout: Network timeout (default 60s) -
saveLocation: Where to save the file (platform-specific, optional) -
subDir: Optional subdirectory within the standard save location -
conflictResolution: How to handle filename conflicts
Yields SaveProgress events during save operation.
Throws NetworkException if the download fails.
Implementation
Stream<SaveProgress> saveNetwork({
required String url,
required String fileName,
required FileType fileType,
Map<String, String>? headers,
Duration timeout = const Duration(seconds: 60),
SaveLocation? saveLocation,
String? subDir,
ConflictResolution conflictResolution = ConflictResolution.autoRename,
});