flutter - 如何从 Flutter Web 应用程序共享 S3 存储桶上的图像?
问题描述
在应用程序的移动版本上,我使用的是esys flutter share 包
这是我正在使用的片段:
() async {
var request = await HttpClient()
.getUrl(Uri.parse(product.imageUrl));
var response = await request.close();
Uint8List bytes =
await consolidateHttpClientResponseBytes(response);
await Share.file(
'Text to show?', 'amlog.jpg', bytes, 'image/jpg',
text: '${product.name}\nSolo por $finalPrice');
}
不幸的是,这个包不支持 Web 平台。
有一个包叫share plus 2.0
在示例中,他们说可以通过以下方式共享文件:
Share.shareFiles(['${directory.path}/image.jpg'], text: 'Great picture');
Share.shareFiles(['${directory.path}/image1.jpg', '${directory.path}/image2.jpg']);
但是,就我而言,该文件位于 S3 上。我需要将它下载到某个应用程序文件夹中。因为我的应用程序是 Web 我不知道如何下载图片并存储在应用程序的文件夹中。这可能吗?还有其他方法可以实现我想要的吗?
解决方案
将下载的文件保存在变量中,然后将其推送到您需要的地方。
推荐阅读
- java - 错误:SQLException: Parameter index out of range (1 > number of parameters, which is 0)
- html - 我想制作一个可以在列表中创建列表的 django 应用程序
- mysql - 改进了在 SELECT WHERE IN 语句中找出“未使用”值的方法
- aws-codepipeline - AWS CodeBuild 因 .net 控制台应用程序的 CommandNotFoundException 而失败
- javascript - Tampermonkey 脚本点击事件在用户与窗口交互之前什么都不做
- python - 如何使用 geopanda 或 shapely 在同一地理数据框中找到最近的点
- python-3.x - 如何指定要在 sonarqube 中扫描的语言版本?
- amazon-redshift - Redshift 是否支持 SELECT 中的用户定义变量?
- html - 在 VBA 中使用 XMLHTTP 对象解析一些网站
- python - 我们可以在没有 GPU 的自定义对象上训练 YOLOv3 吗?