搜索分类、插件与代码仓

插件详情v2.27.3

gotrue

GoTrue API 的 Dart 客户端库。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
135万
喜欢数
16
Pub 分数
140

安装插件

flutter pub add gotrue

插件介绍

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

一个用于与 GoTrue 认证 API 交互的 Dart 客户端库,可在 Flutter 应用中实现安全的用户管理。它支持注册、登录、密码恢复和会话处理,并具备内置的令牌管理功能。专为与 Supabase 无缝集成而设计,可在多个平台上提供一致的认证体验。该库可处理状态持久化,并通过监听器提供实时更新。非常适合需要强大且可扩展认证功能的应用开发。

适合场景

  • 用户注册和登录
  • 密码重置工作流程
  • 会话管理
  • 实时身份验证状态更新
  • 多平台认证

主要特点

  • 安全的令牌处理
  • 内置会话持久化
  • 实时身份验证侦听器
  • 支持电子邮件/密码和社交登录
  • 跨平台兼容性

适合对象

  • 使用 Supabase 的 Flutter 应用
  • 需要安全认证的应用程序
  • 开发跨平台应用的开发者
  • 需要实时身份验证状态的项目
  • 希望简单身份验证设置的团队

使用建议

  • 需要一个 GoTrue 后端(例如 Supabase)
  • 仅限 GoTrue 特定功能
  • 需要对网络问题进行适当的错误处理
  • 认证流程必须针对 UI 进行自定义
  • 依赖于 Supabase 生态系统

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

所属分类

依赖

依赖清单 8 项

源码仓库

使用此插件的项目

暂无相关数据。