【发布时间】:2021-01-09 19:22:21
【问题描述】:
我有问题。每次当我从我的图库中搜索我的个人资料图片时,它的作品。即使当我按下注销按钮并再次登录时,我的头像仍然存在。但是当我关闭应用程序并重新启动应用程序时,头像就消失了。有谁知道如何正确保存网址?
Future uploadPic(BuildContext context) async {
String fileName = basename(_image.path);
StorageReference firebaseStorageRef = FirebaseStorage.instance.ref().child(
fileName);
StorageUploadTask uploadTask = firebaseStorageRef.putFile(_image);
StorageTaskSnapshot taskSnapshot = await uploadTask.onComplete;
var downUrl = await (await uploadTask.onComplete).ref.getDownloadURL();
Constants.URL_Profil_Picture = downUrl.toString();
setState(() {
print('Profile Picture uploaded');
Scaffold.of(context).showSnackBar(
SnackBar(content: Text('Profile Picture Uploaded')));
});
}
image: (_image != null) ? FileImage(
_image)
: NetworkImage(Constants.URL_Profil_Picture),
【问题讨论】:
标签: firebase flutter firebase-storage