downloadToFile method
Downloads a file from the cloud to a local path and specifies the file name. The file is managed by your app. When the local file is not 0 KB, the API uses the downloaded file size as the resumable download position to proceed with download from the cloud.
- destinationFile: Destination file where a downloaded file will be stored, which must be created in advance.
Implementation
Future<AGCStorageDownloadTask> downloadToFile(File destinationFile) async {
try {
final String? taskId = await _methodChannel.invokeMethod<String?>(
'AGCStorageReference#downloadToFile',
<String, dynamic>{
'bucket': storage.bucket,
'policyIndex': storage.policy?.index,
'objectPath': path,
'filePath': destinationFile.path,
},
);
return AGCStorageDownloadTask._(taskId!, this);
} catch (e) {
throw AGCStorageException._from(e);
}
}