i want to upload image to Firebase Storage, but I noticed most of the code available online (except documentation) has deprecated. as i am new to flutter, I read documentation for image picker and firestore. i was able to figure out image picker, but uploading in bucket of firestore is giving me the tough time.
below is the code for imagepicker,that i managed to do correctly:
File _image;
final picker = ImagePicker();
Future getImage() async {
final pickedFile = await ImagePicker().getImage(source: ImageSource.camera);
setState(() {
if (pickedFile != null) {
_image = File(pickedFile.path);
} else {
print('No image selected.');
}
});
}
now i dont know how to complete the upload to Firebase Storage function:
Future UploadImage(BuildContext context) async{
String filename = basename(_image.path);
firebase_storage.FirebaseStorage storage = firebase_storage.FirebaseStorage.instance;
// how to proceed?
}