AuthProvider<TSignup, TUser> class
abstract
The backend behind the auth flows. Each app writes one subclass for its backend (REST, Firebase, Supabase, ...).
TSignup is the app's own typed signup body; TUser its user model.
Only login and logout must be written. Every other call fails with UnsupportedFailure until the subclass overrides it, and calls added to brix later arrive the same way, so adapters never break on update.
Return Failed for anything the backend rejects. Errors may also be thrown; the flows catch them and turn them into a Failure with mapError. Pass values through as given, never trim or change a password.
Constructors
- AuthProvider()
-
const
Properties
- capabilities → AuthCapabilities
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
forgotPassword(
{required String identifier}) → Future< Result< void> > - Sends the reset code or link, depending on AuthCapabilities.resetMode.
-
login(
{required String identifier, required String password}) → Future< Result< AuthSession< >TUser> > -
logout(
) → Future< Result< void> > - Ends the session on the server. Local data is cleared by the flows even when this fails.
-
mapError(
Object error, StackTrace stackTrace) → Failure -
Turns an error thrown by this backend into a Failure. Override to map
the backend's own errors (socket errors, SDK error codes) and call
super.mapErrorfor the rest. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register(
TSignup request) → Future< Result< void> > -
resendOtp(
{required String identifier, required OtpPurpose purpose}) → Future< Result< void> > -
resetPassword(
{required String identifier, required String newPassword, String? code}) → Future< Result< void> > -
codeis required when AuthCapabilities.resetMode is ResetMode.otp. -
toString(
) → String -
A string representation of this object.
inherited
-
verifyOtp(
{required String identifier, required String code, required OtpPurpose purpose}) → Future< Result< void> >
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited