SupabaseHandler class

Instance-based handler for safely executing Supabase operations with centralized error handling.

DI-friendly and allowing several independently configured handlers.

final handler = SupabaseHandler(MySupabaseErrorRegistry());

Future<Result<User>> getCurrentUser() =>
    handler.safeCall(() => supabase.auth.getUser());
Implementers

Constructors

SupabaseHandler(SupabaseErrorRegistry errorRegistry, {bool enableDebugLogging = false, FailureObserver? onFailure})

Properties

enableDebugLogging bool
Whether caught errors are logged with debugPrint.
getter/setter pair
errorRegistry SupabaseErrorRegistry
The registry consulted for every mapping decision of this handler.
final
hashCode int
The hash code for this object.
no setterinherited
onFailure FailureObserver?
Called for every Err this handler produces from a caught exception (see FailureObserver). Exceptions thrown by the observer itself are swallowed — observability must never break error propagation.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
safeCall<T>(Future<T> request(), {Result<T>? onError(Object error)?}) Future<Result<T>>
Safely executes a Supabase operation and returns a Result.
toString() String
A string representation of this object.
inherited

Operators

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