【发布时间】:2020-10-27 14:41:11
【问题描述】:
我想获取图片下载链接并将其存储在 Firestore 数据库中。下面是上传图片到 Firebase 存储的功能,如果功能错误,请解释原因并给我写一个功能?
File _image1;
Future uploadPic() async {
StorageReference reference = storage.ref().child('image');
StorageUploadTask uploadTask = reference.putFile(_image1);
StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete;
String url = await taskSnapshot.ref.getDownloadURL();
imageUrl1 = url;
}
【问题讨论】: