本文介绍了如何从Flutter中的UploadTaskSnapshot获取完整的downloadUrl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正确地收到了UploadTaskSnapshot,并且字段downloadUrl包含一个Uri实例,该实例解析了上载文件的下载链接.

I correctly receive UploadTaskSnapshot, and the field downloadUrl contains an instance of Uri that parses download link of uploaded file.

如何以字符串形式获取存储和downloadUrl?

How to get storage and downloadUrl as strings?

推荐答案

更新

此答案 https://stackoverflow.com/a/52690889/217408 现在是准确的答案. >

This answer https://stackoverflow.com/a/52690889/217408 is now the accurate one.

final ref = FirebaseStorage.instance
    .ref()
    .child('path')
    .child('to')
    .child('the')
    .child('image_filejpg');

ref.putFile(imageFile);
// or ref.putData(Uint8List.fromList(imageData));

var url = await ref.getDownloadURL() as String;

var url = Uri.parse(await ref.getDownloadURL() as String);

这篇关于如何从Flutter中的UploadTaskSnapshot获取完整的downloadUrl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 15:32