【问题标题】:How can I share images on a S3 bucket from a Flutter Web app?如何从 Flutter Web 应用程序共享 S3 存储桶上的图像?
【发布时间】:2021-06-05 02:11:03
【问题描述】:

在应用程序的移动版本上,我使用的是esys flutter share package

这是我正在使用的 sn-p:

() 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 我不知道如何下载图片并存储在应用程序的文件夹中。这可能吗?还有其他方法可以实现我想要的吗?

【问题讨论】:

    标签: flutter dart flutter-web


    【解决方案1】:

    将下载的文件保存在变量中,然后将其推送到您需要的地方。

    【讨论】:

      猜你喜欢
      • 2021-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-15
      • 2018-03-11
      • 2020-12-30
      • 1970-01-01
      • 2022-10-05
      相关资源
      最近更新 更多