Auth class

Provides and manages authentication state and callbacks.

Mixed-in types

Constructors

Auth({List<LoginProvider> loginProviders = const [], LoginCallback? onLogin, SignupCallback? onSignup, RecoverCallback? onRecoverPassword, ConfirmRecoverCallback? onConfirmRecover, ConfirmSignupCallback? onConfirmSignup, ConfirmSignupRequiredCallback? confirmSignupRequired, SignupCallback? onResendCode, BeforeAdditionalFieldsCallback? beforeAdditionalFieldsCallback, String email = '', String password = '', String confirmPassword = '', AuthMode initialAuthMode = AuthMode.login, List<TermOfService> termsOfService = const []})
Creates an instance of Auth to manage the login/signup state and related callbacks.

Properties

additionalSignupData Map<String, String>?
Additional signup fields entered by the user.
getter/setter pair
authType AuthType
The type of authentication being used (password or provider).
getter/setter pair
beforeAdditionalFieldsCallback BeforeAdditionalFieldsCallback?
Callback triggered before additional signup fields are shown.
final
confirmPassword String
Confirmation password entered by the user during sign up.
getter/setter pair
confirmSignupRequired ConfirmSignupRequiredCallback?
Callback to determine if confirmation step is required during sign up.
final
currentCardIndex int
The current step in a multi-card signup process.
getter/setter pair
email String
Email or username entered by the user.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isLogin bool
True if currently in login mode.
no setter
isSignup bool
True if currently in signup mode.
no setter
loginProviders List<LoginProvider>
List of third-party login providers.
final
mode AuthMode
Current authentication mode (login or signup).
getter/setter pair
onConfirmRecover ConfirmRecoverCallback?
Callback for confirming recovery via code.
final
onConfirmSignup ConfirmSignupCallback?
Callback for confirming sign up via code.
final
onLogin LoginCallback?
Callback triggered when user logs in.
final
onRecoverPassword RecoverCallback?
Callback triggered for password recovery.
final
onResendCode SignupCallback?
Callback triggered when user requests to resend confirmation code.
final
onSignup SignupCallback?
Callback triggered when user signs up.
final
password String
Password entered by the user.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
termsOfService List<TermOfService>
List of terms of service agreements.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
getTermsOfServiceResults() List<TermOfServiceResult>
Returns a list of TermOfServiceResult based on user selections.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
opposite() AuthMode
Returns the opposite of the current AuthMode.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
switchAuth() AuthMode
Switches the current mode between login and signup.
toString() String
A string representation of this object.
inherited

Operators

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