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

插件详情v2.8.1

storage_client

Dart 客户端库,用于与 Supabase Storage 交互。Supabase Storage 提供了一个接口,用于管理存储在 S3 中的文件,并使用 Postgres 来管理权限。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
127万
喜欢数
33
Pub 分数
140

安装插件

flutter pub add storage_client

插件介绍

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

storage_client 包是一个 Dart 库,可让 Flutter 应用程序与 Supabase Storage 进行交互,Supabase Storage 是一个用于管理 S3 兼容存储中的文件的服务,并通过 PostgreSQL 驱动的访问控制进行管理。它提供了安全上传、下载、列出和删除文件的方法,利用 Supabase 的身份验证和权限系统。该包专为与 Supabase 项目无缝集成而设计,支持所有主要平台,包括移动设备、网页和桌面端。该包简化了文件处理,同时通过基于角色的访问控制保持强大的安全性。

适合场景

  • 上传用户生成的内容,如图片或文档
  • 管理存储在云存储中的应用资源
  • 在用户之间实现安全文件共享
  • 在实时应用中存储和检索媒体文件
  • 在Flutter应用中启用动态内容分发

主要特点

  • 通过 Supabase 认证进行安全文件操作
  • 对 S3 兼容存储后端的支持
  • 跨平台兼容性(Android、iOS、Web、macOS、Windows、Linux)
  • 与 Postgres 集成以实现细粒度权限
  • 用于上传、下载和列出文件的简单 API

适合对象

  • 使用 Supabase 作为后端的 Flutter 应用
  • 需要安全文件管理的应用程序
  • 需要可扩展云存储并具备访问控制的项目
  • 开发媒体密集型或基于文档的应用程序的开发者
  • 团队已使用 Supabase 进行身份验证和数据库

使用建议

  • 需要一个启用了存储功能的 Supabase 项目
  • 必须在应用中设置身份验证
  • 文件访问权限取决于Postgres策略
  • 受限于 Supabase 的存储基础设施
  • 可能需要为自定义 S3 配置进行额外设置

原始 README

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


Supabase Logo

Supabase Flutter

Flutter client library for Supabase.

Guides · Reference Docs · Migration Guides

Build Package License: MIT

Run locally

This repo is a monorepo powered by Melos containing supabase_flutter and its sub-libraries. All packages are located in the packages directory.

To install on a locally developed app:

  • Clone this repo
  • Install Melos globally if you haven't already: dart pub global activate melos
  • Run melos bootstrap or melos bs at the root of the cloned directory to install dependencies
  • Add the target package to your pubspec.yaml file specifying the path.
    supabase_flutter:
      path: <your-path-to-the-local-supabase-flutter-repo>/packages/supabase_flutter
    

Testing your app

The helpers the test suites of these packages run on are published in package:supabase_test, so your tests can build on the same primitives: mock HTTP clients, JWT builders, auth session fixtures and realtime frames. Add the package as a dev dependency:

dev_dependencies:
  supabase_test: ^0.1.0

Then stub the endpoints the code under test talks to and run it against a real SupabaseClient, with no running stack required:

final httpClient = MockSupabaseHttpClient()
  ..stubTable('todos', rows: [
    {'id': 1, 'task': 'Ship it', 'status': false},
  ]);
final supabase = testSupabaseClient(httpClient: httpClient);
addTearDown(supabase.dispose);

final todos = await supabase.from('todos').select();
expect(todos, hasLength(1));

See the supabase_test README for the full guide: stubbing database, rpc, edge function and auth endpoints, asserting on recorded requests, running tests as a signed-in user, and wiring Supabase.initialize in Flutter widget tests.

Testing this repo

The tests for the packages postgrest, supabase_auth, supabase_realtime and supabase_storage run against a local Supabase stack. To run these tests locally you need docker and the Supabase CLI installed.

The single configuration for the stack lives in the supabase directory at the repository root. Start it with:

supabase start

Run the Dart tests within the package directory in packages/<package> with the following command. The -j 1 flag runs the tests not concurrently, which works better since the tests run against the same services.

dart test -j 1

To stop the stack run the following command from the repository root:

supabase stop

Contributing

  • Fork the repo on GitHub
  • Clone the project to your own machine
  • Commit changes to your own branch
  • Push your work back up to your fork
  • Submit a Pull request so that we can review your changes and merge

License

This repo is licensed under MIT.

Resources

所属分类

依赖

依赖清单 5 项

源码仓库

使用此插件的项目

暂无相关数据。