deleteFile method

Future<void> deleteFile({
  1. required String storagePath,
})

Deletes a file from Firebase Storage.

storagePath: The path in Firebase Storage of the file to delete. Example: uploads/images/file.jpg

Returns a Future that resolves once the file has been deleted.

Implementation

Future<void> deleteFile({required String storagePath}) async {
  Reference storageReference = FirebaseStorage.instance.ref(storagePath);
  await storageReference.delete();
}