重要提示:我发现了同样的问题,但它因调试信息不完整而关闭。
我将图像上传到 firebase 存储,然后获取该图像的下载 URL 并将其存储到 firebase,以便我可以使用该 URL 通过网络图像显示用户的个人资料图像。
之前我存储图像时工作正常
Reference storageRef = FirebaseStorage.instance.ref('images');
file = await _compressImage(file: file,);
await storageRef.putFile(file);
final String downloadUrl = await storageRef.child(id).getDownloadURL();
return downloadUrl;
Run Code Online (Sandbox Code Playgroud)
但是当我将图像存储在特定文件夹中之后
Reference storageRef = FirebaseStorage.instance.ref('images');
file = await _compressImage(file: file, id: id);
await storageRef
.child(Get.find<UserController>().user.username)
.child(id)
.putFile(file);
final String downloadUrl = await storageRef.child(id).getDownloadURL();
return downloadUrl;
Run Code Online (Sandbox Code Playgroud)
它显示此错误。
[firebase_storage/object-not-found] No object exists at the desired reference.
Run Code Online (Sandbox Code Playgroud)
这是可解释的代码: 我将可下载的 URL 存储在 newImage 变量中
String newImage;
if (_controller.file != null) {
newImage = await …Run Code Online (Sandbox Code Playgroud)