Last active
September 22, 2020 03:40
-
-
Save adamcyber1/b110ac72948d50f51d7daf19aac2031e to your computer and use it in GitHub Desktop.
Doogle Grive download file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void downloadFile(StorageItem item) async { | |
try { | |
var dir = await DownloadsPathProvider.downloadsDirectory; | |
var url = await Amplify.Storage.getUrl( | |
key: item.key, options: GetUrlOptions(expires: 3600)); | |
await checkPermission(); | |
await FlutterDownloader.enqueue( | |
url: url.url, | |
fileName: item.key.split('/').last, | |
savedDir: dir.path, | |
showNotification: true, | |
openFileFromNotification: true, | |
); | |
} catch (e) { | |
print(e.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment