postImageOnFirebase function
Implementation
Future<String> postImageOnFirebase(collection, File file) async {
Reference ref = FirebaseStorage.instance
.ref()
.child(collection + "/${DateTime.now().microsecondsSinceEpoch}");
UploadTask uploadTask = ref.putFile(file);
try {
await uploadTask;
String? profile = await ref.getDownloadURL();
return profile;
} catch (e) {
return handleFirebaseStorageError(e);
}
}