downloadFile method
Implementation
@override
Future<bool> downloadFile(String fileId, String saveName, {String? bucketId}) async {
try {
await initialize();
if (kIsWeb) {
Uint8List? targetBytes = await getFileBytes(fileId, bucketId: bucketId);
String targetUrl = Url.createObjectUrlFromBlob(Blob([targetBytes]));
AnchorElement(href: targetUrl)
..setAttribute("download", saveName)
..click();
Url.revokeObjectUrl(targetUrl);
return true;
}
} catch (error) {
logger.info("error at Storage.downloadFile >>> $error");
}
return false;
}