我有一个像“https://example.com/xyz.jpg”这样的图片网址。现在我想把图像放在一个文件类型变量中;
沿着这些路线的东西:
File f = File("https://example.com/xyz.jpg");
Run Code Online (Sandbox Code Playgroud)
重点是从给定的 URL 获取图像并将其保存为 File 变量。我怎么能这样做?我在互联网上搜索了许多解决方案,但没有直接的方法。
PS:我可能遗漏了一些类似回答的问题,所以请告诉我可以找到它的链接。
编辑:我使用文件类型变量将它传递到共享函数中。 这是我正在使用的库。
这是我当前的分享按钮点击代码
if (file != null) {
ShareExtend.share(file.path, "image",
sharePanelTitle: "share image title",
subject: "share image subject");
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。