upload file in flutter web to firebase storage 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