【发布时间】:2020-03-19 07:53:22
【问题描述】:
我正在使用ImagePickerWeb 并在Storage 中上传图片。为了显示这些图像,我使用了 url。如果用户更改图像,如何在存储中更新?第一个需要删除以前的图像并重新上传吗?
Future uploadImg() async {
var timekey = DateTime.now();
fb.StorageReference storageReference =
fb.storage().ref('imgProduct/${timekey.toString()}.jpg');
fb.UploadTaskSnapshot uploadTask = await storageReference
.put(_image1, fb.UploadMetadata(contentType: 'image/jpg'))
.future;
var imageUrl = await uploadTask.ref.getDownloadURL();
url = imageUrl.toString();
print('Image Url' + url);
}
【问题讨论】:
标签: flutter dart flutter-web