【发布时间】:2021-03-23 09:10:42
【问题描述】:
我试图让这个应用程序学习在 Firebase 中使用的方法,现在,我正在使用 Cloud Firestore + Storage,但我收到了这个错误:
Exception has occurred.
FirebaseException ([firebase_storage/object-not-found] No object exists at the desired reference.)
我是 firebase 上的新人,所以我不知道该怎么办...还有很多更新和更改,其他帖子中的一些回复已被弃用...
Future<void> uploadPic(File foto) async {
final Reference postImageRef = FirebaseStorage.instance.ref().child('Post Images');
var timeKey = DateTime.now();
await postImageRef.child(timeKey.toString() + "jpg").putFile(foto)
.whenComplete(() async { //IM GETTING THE ERROR HERE
await postImageRef.getDownloadURL().then((value) { //IM GETTING THE ERROR HERE
posts.imageUrl = value;
});
});
return posts.imageUrl;
}
这里是“保存”按钮的提交
void _submit() async {
if (!formKey.currentState.validate()) return null;
formKey.currentState.save();
uploadPic(foto);
subirPost(posts);
print(posts.datetime);
mostrarToast('Producto guardado');
}
【问题讨论】:
标签: android firebase flutter firebase-storage