Skip to content
pubscout

better_auth_flutter

0.1.2, released 3 months ago by stormej.me

Flutter SDK for Better Auth providing email/password, social sign‑in, session management and reactive auth state.

$ flutter pub add better_auth_flutter
Source repository

What it does

It wraps Better Auth's REST API with a Dio client, handling authentication flows, cookie or bearer sessions, and exposing a sealed Result type for all calls. It also offers Riverpod 3 providers and streams to reactively track auth state.

AI-written summary of version 0.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a custom backend authentication solution rather than Firebase or Supabase
  • You want reactive auth state with Riverpod or Stream listeners
  • You require secure cookie‑based sessions across platforms

Skip it when

  • You only need simple OAuth with Google/Apple and don't need a full backend
  • You prefer a fully managed BaaS like Firebase

Strengths

  • Unified API for email, password, social and passkey auth
  • Reactive auth state via streams and Riverpod providers
  • Secure cookie storage with automatic persistence

Weaknesses

  • Tied to Better Auth backend; not a generic OAuth library
  • Requires manual setup of the Better Auth server
  • No code generation; models must be maintained manually

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
Yes (build_runner)
Direct dependencies
16

Add the package, call BetterAuthFlutter.initialize with your server URL before runApp; no native permissions required

import 'package:better_auth_flutter/better_auth_flutter.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await BetterAuthFlutter.initialize(url: 'https://example.com/api/auth');
  runApp(const MyApp());
}

Future<void> signIn() async {
  final result = await BetterAuthFlutter.client.signInEmail(email: 'user@example.com', password: 'secret');
  result.when(
    success: (data) => print('Welcome ${data.user?.name}'),
    failure: (error) => print('Error: ${error.message}'),
  );
}

Alternatives

Packages that do the same job and could replace better_auth_flutter.

Works with

Packages commonly used together with better_auth_flutter: ones it builds on, ones built on it, and its own family.