Created
September 22, 2020 00:21
-
-
Save adamcyber1/c96d4d335a4c4a0737780cccbe19dc7e to your computer and use it in GitHub Desktop.
Doogle Grive List 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
Future<List<StorageItem>> listFiles() async { | |
try { | |
ListResult res = await Amplify.Storage.list(); | |
AuthUser user = await Amplify.Auth.getCurrentUser(); | |
List<StorageItem> items = res.items | |
.where((e) => e.key.split('/').first.contains(user.username)) | |
.toList(); | |
return items; | |
} catch (e) { | |
Alert( | |
context: context, | |
type: AlertType.error, | |
desc: "Error Listing Files: " + e.toString()).show(); | |
// return an empty list if something fails | |
return List<StorageItem>(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment