【发布时间】:2021-09-09 00:47:25
【问题描述】:
我可以成功上传图片但无法获取上传图片的URL 另外随着最近方法的变化,我想写一个比这更干净的代码。
try {
await FirebaseStorage.instance
.ref()
.child('user_image')
.child(authResult.user
.uid + //ref gives access to root cloud store , firebase manages all the tokens etc
'.jpg')
.putFile(image);
} on FirebaseException catch (e) {
print(e);
}
//Download the Url
String url = await FirebaseStorage.instance
.ref()
.child('user_image')
.child(authResult.user
.uid + //ref gives access to root cloud store , firebase manages all the tokens etc
'.jpg')
.getDownloadURL();
print('Url' + url);
【问题讨论】:
标签: flutter dart firebase-storage