I want to upload the network image path to the storage. The image URL like https://firebasestorage.googleapis.com/v0/b/elderlyapp-b7344.appspot.com/o/MedImages%2FJkgWeoMvT1gYoa0YnBvxQU6qPef1_2024-04-01%2001%3A44%3A03.075256. Since I want to keep the first image when the first image deletes, I can also read the second image which same as the first image.
This is the function
Future<String> uploadNetworkImage(String imagePath) async {
try {
final imagesRef = storage
.ref("MedImages")
.child("${currentUser}_${DateTime.now()}.jpg");
await imagesRef.putString(imagePath, format: PutStringFormat.dataUrl);
final String imageUrl = await imagesRef.getDownloadURL();
return imageUrl;
} on FirebaseException catch (e) {
print(e);
return "";
}
}
I want to upload network image to firebase storage