firebase storage uploading and retrieving images in flutter code example

Example: upload to firebase storage flutter

Future<String> uploadFile(File _image) async {  StorageReference storageReference = FirebaseStorage.instance      .ref()      .child('sightings/${Path.basename(_image.path)}');  StorageUploadTask uploadTask = storageReference.putFile(_image);  await uploadTask.onComplete;  print('File Uploaded');  String returnURL;  await storageReference.getDownloadURL().then((fileURL) {    returnURL =  fileURL;  });  return returnURL;}

Tags:

Misc Example