pickImage function
Implementation
Future<String> pickImage(
String collection, ImageSource source, int imageQuality) async {
XFile? image = await ImagePicker().pickImage(source: source);
if (image == null) {
return "";
}
Reference ref = FirebaseStorage.instance
.ref()
.child("$collection/${DateTime.now().microsecondsSinceEpoch}");
UploadTask uploadTask = ref.putFile(File(image.path));
try {
await uploadTask;
String? profile = await ref.getDownloadURL();
return profile;
} catch (e) {
return handleFirebaseStorageError(e);
}
}