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

插件详情v2.16.5

supabase

Supabase 的 Dart 客户端。此客户端使开发人员能够轻松构建安全且可扩展的产品。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
133万
喜欢数
618
Pub 分数
150

安装插件

flutter pub add supabase

插件介绍

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

Supabase 是一个 Dart 客户端,可帮助开发者轻松地将 Supabase 的后端服务集成到 Flutter 应用中。它提供安全、实时的数据库、身份验证、文件存储等访问功能,且设置简单。该客户端支持多种平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常适合跨平台应用开发。通过内置的 JWT 身份验证和行级安全支持,Supabase 帮助开发者快速构建可扩展且安全的应用程序。

适合场景

  • 实时数据同步
  • 用户身份验证和授权
  • 基于云的文件存储
  • Flutter 应用的后端即服务
  • 可扩展的数据库操作

主要特点

  • 实时数据库订阅
  • 内置身份验证(电子邮件、OAuth)
  • 行级安全
  • 带有预签名URL的文件存储
  • 跨平台兼容性

适合对象

  • 全栈Flutter开发人员
  • 初创公司构建MVP
  • 需要实时更新的应用程序
  • 需要安全后端服务的团队
  • 具有多平台部署的项目

使用建议

  • 需要设置一个 Supabase 项目
  • 后端操作的网络依赖
  • 免费套餐的速率限制
  • 需要安全地管理 API 密钥
  • 有限的离线功能,无需额外逻辑

原始 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

所属分类

依赖

依赖清单 10 项

源码仓库

使用此插件的项目