BloomSupabaseAuthAdapter class

Official Bloom authentication adapter for Supabase with real token refresh support.

Integrates with BloomAuth to provide reactive authentication state signals (currentUser, isAuthenticated).

Example:

final auth = BloomSupabaseAuthAdapter(
  supabaseUrl: 'https://xyz.supabase.co',
  supabaseAnonKey: 'anon-key-here',
);
await auth.signInWithPassword(email: 'user@example.com', password: 'secret');
Inheritance

Constructors

BloomSupabaseAuthAdapter({required String supabaseUrl, required String supabaseAnonKey, SupabaseClient? supabaseClient, BloomStorageAdapter? storage, String sessionKey = 'bloom_supabase_session'})
Creates a BloomSupabaseAuthAdapter.

Properties

currentUser ReadonlySignal<BloomSupabaseUser?>
Reactive signal containing the currently authenticated user model, or null if unauthenticated.
no setterinherited
fromJson BloomSupabaseUser Function(Map<String, dynamic> json)?
Deserializer function converting JSON maps to typed user model instances.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
isAuthenticated ReadonlySignal<bool>
Reactive boolean signal indicating whether an active authenticated session exists.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionKey String
Key identifier used when writing session data into storage (defaults to 'bloom_auth_session').
finalinherited
storage BloomStorageAdapter?
Optional persistent storage adapter for caching session state across application restarts.
finalinherited
supabaseAnonKey String
Supabase anonymous API key.
final
supabaseClient → SupabaseClient?
Optional live sb.SupabaseClient instance to observe real-time auth changes.
final
supabaseUrl String
Base Supabase backend URL.
final
toJson Map<String, dynamic> Function(BloomSupabaseUser user)?
Serializer function converting typed user model instances to JSON maps.
finalinherited
token ReadonlySignal<String?>
Reactive signal containing the current authentication bearer token, or null if unauthenticated.
no setterinherited

Methods

dispose() Future<void>
Cancel auth state listeners and release resources.
login(String token, BloomSupabaseUser user) Future<void>
Logs in the user, setting the active token and user session.
inherited
logout() Future<void>
Clears the active user session and purges persistent session storage.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshSession() Future<BloomSupabaseUser?>
Refresh the active Supabase session using the stored refresh token.
restoreSession() Future<bool>
Restores user session from persistent storage on application startup.
inherited
setSession({required BloomSupabaseUser user, required String token}) Future<void>
Sets the active user user and token session, and persists it to storage if configured.
inherited
signInWithPassword({required String email, required String password}) Future<BloomSupabaseUser>
Sign in with email and password via Supabase Auth API.
signUp({required String email, required String password, Map<String, dynamic>? data}) Future<BloomSupabaseUser>
Sign up a new user via Supabase Auth API.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited