Image &引用;无法转换'_Uri'&引用;在云firestore上上载图像时出错';在颤振网络上发布的最新版本

Image &引用;无法转换'_Uri'&引用;在云firestore上上载图像时出错';在颤振网络上发布的最新版本,image,firebase,flutter,google-cloud-firestore,google-cloud-storage,Image,Firebase,Flutter,Google Cloud Firestore,Google Cloud Storage,使用最新版本的cloud\u firestore:^0.14.0+2在cloud firestore上载图像时出现以下错误 Uncaught(in promise)错误:[cloud\u firestore/unknown]无效参数(dartObject):无法转换:'\u Uri'的实例 映像已成功上载到存储部分,但在cloud firestore db中未更新映像链接 下面是我选择图片并点击上传btn上传图片的课堂 类AddNewItemView扩展StatefulWidget{ @凌驾

使用最新版本的
cloud\u firestore:^0.14.0+2
在cloud firestore上载图像时出现以下错误

Uncaught(in promise)错误:[cloud\u firestore/unknown]无效参数(dartObject):无法转换:'\u Uri'的实例
映像已成功上载到存储部分,但在cloud firestore db中未更新映像链接

下面是我选择图片并点击上传btn上传图片的课堂

类AddNewItemView扩展StatefulWidget{
@凌驾
_AddNewItemViewState createState()=>\u AddNewItemViewState();
}

类_AddNewItemViewState扩展了状态

,因为您只需要将URL存储到firestore中,您并不真正需要
getDownloadURL()
值作为
Uri
对象,您只需要它的字符串值,因为您会遇到转换错误,因此我建议您遵循本文中的建议,这样,您的代码将如下所示:

String uploadImageFile(
    MediaInfo mediaInfo, String ref, String fileName) async {
        try {
            ...

            var imageUri = await uploadTaskSnapshot.ref.getDownloadURL() as String;
            print("download url $imageUri");  <---- IT GETS P[RINTED AND IT SHOWED VALED IMAGE URL STORED IN STORAGE
            return imageUri
        } catch (e) {
            ...
        }
    }
})
String _uploadedImgURL = await ConstantFtns()
                 .uploadImageFile(pic, "ImgPathString", "fileName");