我正在使用下面的代码从画廊中上传图片,如果没有从画廊中提取图片,我希望将图片从画廊assets
上传到 Firebase 存储,因为这avatarImageFile
应该等同于来自的图像文件资产。我怎样才能做到这一点?
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 `
}
}