I have been trying to store files to Firebase Storage but couldn't really get it. So, please help me solve this problem I have to store a single image file to Firebase Storage and then get the URL or the file and store it in Realtime Database, all for Flutter Web-App.
Thanks
These are the codes for selecting file
Future selectFile() async {
final _picker = ImagePicker();
var image;
image = await _picker.pickImage(source: ImageSource.gallery);
return image;
}
These are the codes for storing File
Future addPhotoTStorage(File file) async {
final storage = FirebaseStorage.instance;
var snapshot = await storage.ref().child(file.path).putFile(file);
String url = await snapshot.ref.getDownloadURL();
return url;
}