【发布时间】:2020-10-26 06:32:47
【问题描述】:
我正在使用下面的代码从画廊上传图片,如果没有从画廊中提取图片,我希望将来自 assets 的图片上传到 firebase 存储,因为 @987654322 @ 应该等同于资产中的图像文件。
我怎样才能做到这一点?
Future getImage() async {
print("get image");
PickedFile image = await _picker.getImage(source: ImageSource.gallery);
if (image != null) {
setState(() {
final File file = File(image.path);
avatarImageFile = file;
isLoading = true;
});
}
else{
//if image is null then the image from the assets should be made picked into `avatarImageFile `
}
}
【问题讨论】:
标签: flutter imagepicker