Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 1, 2024

Remove files

Remove a file

You can remove a single file using Amplify.Storage.remove.

Future<void> removeFile() async {
try {
final result = await Amplify.Storage.remove(
path: const StoragePath.fromString('public/file.txt'),
).result;
safePrint('Removed file: ${result.removedItem.path}');
} on StorageException catch (e) {
safePrint(e.message);
}
}

Remove multiple files

You can remove multiple files using Amplify.Storage.removeMany.

Future<void> remove() async {
try {
final result = await Amplify.Storage.removeMany(
paths: [
const StoragePath.fromString('public/file-1.txt'),
const StoragePath.fromString('public/file-2.txt'),
],
).result;
safePrint('Removed files: ${result.removedItems}');
} on StorageException catch (e) {
safePrint(e.message);
}
}