gpt4 book ai didi

flutter - 如何在 Flutter 中将图像 url 转换为 XFile?

转载 作者:行者123 更新时间:2023-12-03 08:00:31 27 4
gpt4 key购买 nike

我在服务器上遇到问题,我正在以字符串形式获取图像 url 数据。我需要将所有这些 url 保存在 XFile 格式列表中。告诉我如何将图像 url 转换为 XFile 格式?

我明白了

enter image description here

最佳答案

试试这个:

static Future<XFile> getImageXFileByUrl(String url) async {
var file = await DefaultCacheManager().getSingleFile(url);
XFile result = await XFile(file.path);
return result;
}

关于flutter - 如何在 Flutter 中将图像 url 转换为 XFile?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74450161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com