Reputation: 35
I got the link of image that I store in firebase storage. By using the link I can access the image I want.
I found a method of deleting images in storage by its image name (example: "helloImage.jpg").
final StorageReference firebaseStorageRef = FirebaseStorage.instance.ref().child(imageFileName);
try{
await firebaseStorageRef.delete();
} catch (e){
return e.toString();
}
Is there any method to delete image in firebase storage by using the link instead of name ?
Upvotes: 0
Views: 94
Reputation: 8246
using getReferenceFromUrl method in **StorageReference **.
we can delete it using the reference.
FirebaseStorage.instance
.getReferenceFromUrl(imageUrl)
.then((reference) => reference.delete())
.catchError((e) => print(e));
Upvotes: 1