Page updated Jan 16, 2024

Remove files

Amplify Flutter v0 is now in Maintenance Mode until July 19th, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v0.

Please use the latest version (v1) of Amplify Flutter to get started.

If you are currently using v0, follow these instructions to upgrade to v1.

Remove a file

Remove a file uploaded to S3 by using Amplify.Storage.remove and specifying the key:

1Future<void> removeFile(String key) async {
2 try {
3 final result = await Amplify.Storage.remove(key: key);
4 safePrint('Removed file: ${result.key}');
5 } on StorageException catch (e) {
6 safePrint('Error deleting file: $e');
7 }
8}