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

插件详情v2.7.1

functions_client

Supabase 函数的 Dart 客户端库。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
129万
喜欢数
7
Pub 分数
130

安装插件

flutter pub add functions_client

插件介绍

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

functions_client 包是一个 Dart 库,可让 Flutter 应用程序与 Supabase Functions 进行交互,使开发者能够直接从应用中调用无服务器函数。它提供了一个简单且类型安全的 API,用于向 Supabase 托管的函数发起 HTTP 请求,支持身份验证和错误处理。非常适合执行后端逻辑,例如数据处理、文件操作或第三方集成,而无需管理服务器。该客户端可与 Supabase 的认证和数据库服务无缝集成。

适合场景

  • 从 Flutter 应用调用无服务器函数
  • 在不管理服务器的情况下执行后端逻辑
  • 与 Supabase 认证和数据库集成
  • 通过无服务器函数处理文件操作
  • 使用自定义后端逻辑自动化工作流程

主要特点

  • 类型安全的函数调用
  • 内置身份验证支持
  • 错误处理和重试机制
  • 跨平台兼容性
  • 简单的 HTTP 请求接口
  • 与 Supabase 生态系统的集成

适合对象

  • 使用 Supabase 的 Flutter 开发人员
  • 需要无服务器后端逻辑的项目
  • 需要安全函数执行的应用程序
  • 构建全栈 Flutter 应用的团队
  • 希望后端基础设施尽可能简化的开发者

使用建议

  • 需要一个已部署函数的 Supabase 项目
  • 必须在 Supabase 中配置身份验证
  • 仅限 Supabase Functions 端点
  • 依赖网络连接
  • 不适合复杂的服务器端应用

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

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目

暂无相关数据。