Skip to content

Instantly share code, notes, and snippets.

@adamcyber1
Last active September 22, 2020 03:40
Show Gist options
  • Save adamcyber1/b110ac72948d50f51d7daf19aac2031e to your computer and use it in GitHub Desktop.
Save adamcyber1/b110ac72948d50f51d7daf19aac2031e to your computer and use it in GitHub Desktop.
Doogle Grive download file
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