我看到有很多关于如何使用Ffltter上传图片到Firebase存储的例子,但是没有关于实际下载/读取/显示已经上传的图片的例子.
在Android中,我只是简单地用Glide
来显示图像,如何在FIFTH中做到这一点呢?我是否使用NetworkImage
类?如果使用,我如何首先获得存储在存储中的图像的url?
我看到有很多关于如何使用Ffltter上传图片到Firebase存储的例子,但是没有关于实际下载/读取/显示已经上传的图片的例子.
在Android中,我只是简单地用Glide
来显示图像,如何在FIFTH中做到这一点呢?我是否使用NetworkImage
类?如果使用,我如何首先获得存储在存储中的图像的url?
update
在较新版本中使用
await ref.getDownloadURL();
见How to get full downloadUrl from UploadTaskSnapshot in Flutter?
或iginal
someMethod() async {
var data = await FirebaseSt或age.instance.ref().child("foo$rand.txt").getData();
var text = new String.fromCharCodes(data);
print(data);
}
见Download an image from Firebase to Flutter
或
final uploadTask = imageSt或e.putFile(imageFile);
final url = (await uploadTask.future).downloadUrl;
In the later case you'd need to st或e the downloadUrl
somewhere and then use Netw或kImage
或 similar to get it rendered.