I have a problem with Firebase. I learned flutter using a video on youtube about how to delete data and images from firebase. And I have one function that deletes the image from firestore but I cannot use getReferenceFromUrl(). It shows the error
The method 'getReferenceFromUrl' isn't defined for the type 'FirebaseStorage'.
deleteFood(Food food, Function foodDeleted) async {
if (food.image != null) {
Reference storageReference =
await FirebaseStorage.instance.getReferenceFromUrl(food.image);
print(storageReference.path);
await storageReference.delete();
print('image deleted');
}
await FirebaseFirestore.instance.collection('Foods').doc(food.id).delete();
foodDeleted(food);
}