搜索插件、代码仓与 APP 分类

插件详情v0.6.0

flutter_aws_s3_client

一个简单的、非官方的 Dart AWS S3 客户端。支持下载对象和列出存储桶中的对象。

AndroidiOSmacOSWindowsLinux
近 30 天下载
123
喜欢数
35
Pub 分数
100

安装插件

flutter pub add flutter_aws_s3_client

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个轻量级的、非官方的 AWS S3 客户端,适用于 Flutter 和 Dart,可实现与 Amazon S3 的简单交互。它支持下载对象和列出存储桶内的内容,适用于需要从 S3 进行基本文件检索和浏览的应用程序。该包专为跨平台使用而设计,可在 Android、iOS、macOS、Windows 和 Linux 上运行。该包并非由 AWS 官方维护,但提供了无需复杂依赖的简单访问方式。

适合场景

  • 从 S3 存储桶下载文件
  • 列出 S3 存储桶中的对象
  • 将 S3 存储集成到 Flutter 应用中
  • 云环境中的简单文件管理
  • 跨平台云文件访问

主要特点

  • 支持 S3 对象下载
  • 列出存储桶中的对象
  • 轻量且依赖极少
  • 跨平台兼容性
  • 无需官方 AWS SDK

适合对象

  • 使用 S3 集成开发 Flutter 应用的开发者
  • 需要基本 S3 操作的项目
  • 需要从 AWS S3 检索文件的应用程序
  • 原型或小规模云存储需求
  • 具有简单S3需求的非企业应用程序

使用建议

  • 非官方 AWS SDK
  • 限制为下载和列表操作
  • 无上传或高级S3功能
  • 可能需要手动处理身份验证
  • 最适合非关键或实验性用例

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Pub Package

DEPRECATED

Since there is now an official package for accessing AWS services, I decided to not longer support this package. please migrate to https://github.com/aws-amplify/amplify-flutter / https://pub.dev/packages/amplify_storage_s3/example

flutter_aws_s3_client

Supports downloading objects and listing objects in a bucket.

The heavy lifting was done by Amazon Cognito Identity SDK for Dart, this project contains just convenience methods for common use cases.

if you need more requests, you can use this instead to build what you need. If you implement more methods, feel free to open a pull request.

Usage

Build the client
  const region = "eu-central-1";
  const bucketId = "yourBucketId";
  final AwsS3Client s3client = AwsS3Client(
      region: region,
      host: "s3.$region.amazonaws.com",
      bucketId: bucketId,
      accessKey: "<your access key>",
      secretKey: "<your secret key>");

Get an object
final response = await s3client.getObject("your/object/key"); 
List objects of the bucket
ListBucketResult listBucketResult =
  await s3client.listObjects(prefix: "dir1/dir2/", delimiter: "/");
print(listBucketResult.toString());

If you want to use a custom http client, use the method buildSignedGetParams. This method returns an object containing the URL and the Authorization headers, which can be used to build the request with your preferred http client.

Download a large object to a file without keeping everything in-memory (streaming)

Use the buildSignedGetParams method.

Example code (with ETag support):


Future download(String key, File file, [String etag = null]) async {

  final signedParams = awsS3Client.buildSignedGetParams(key: key);

  final request = await HttpClient().getUrl(signedParams.uri);

  for (final header in (signedParams.headers ?? const {}).entries) {
    request.headers.add(header.key, header.value);
  }
  if(eTag != null){
    request.headers.add(HttpHeaders.ifNoneMatchHeader, eTag);
  }
  final response = response = await request.close();
  if(response.statusCode != HttpStatus.ok){
     //handle error  
  }else{
     return response.pipe(file.openWrite());
  }
}

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。