AuthenticationRepository class
AuthenticationRepository is responsible for managing user authentication using Firebase Authentication. It provides methods for email/password login and registration
- Inheritance
-
- Object
- GetLifeCycle
- DisposableInterface
- GetxController
- AuthenticationRepository
Constructors
Properties
- firebaseUser → User?
-
Getters
no setter
- getDisplayName → String
-
no setter
- getPhoneNo → String
-
no setter
- getUserEmail → String
-
no setter
- getUserID → String
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
no setterinherited
- initialized → bool
-
Checks whether the controller has already been initialized.
no setterinherited
- isClosed → bool
-
Checks whether the controller has already been closed.
no setterinherited
- listeners → int
-
no setterinherited
-
onDelete
→ InternalFinalCallback<
void> -
Internal callback that starts the cycle of this controller.
finalinherited
-
onStart
→ InternalFinalCallback<
void> -
Called at the exact moment the widget is allocated in memory.
It uses an internal "callable" type, to avoid any @overrides in subclases.
This method should be internal and is required to define the
lifetime cycle of the subclass.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userStorage → GetStorage
-
final
Methods
-
$configureLifeCycle(
) → void -
inherited
-
addListener(
GetStateUpdate listener) → Disposer -
Register a closure to be called when the object notifies its listeners.
inherited
-
addListenerId(
Object? key, GetStateUpdate listener) → Disposer -
inherited
-
deleteUser(
) → Future< void> - DeleteUser - Valid for any authentication. This method deletes the current user from Firebase Authentication. It handles FirebaseAuthException to provide custom error messages. @throws String if the deletion fails due to an authentication error.
-
dispose(
) → void -
inherited
-
disposeId(
Object id) → void -
To dispose an
id
from future updates(), this ids are registered byGetBuilder()
or similar, so is a way to unlink the state change with the Widget from the Controller.inherited -
loginWithEmailAndPassword(
String email, String password) → Future< void> - EmailAuthentication - LOGIN This method allows users to log in using their email and password. It handles FirebaseAuthException to provide custom error messages. @param email The user's email address. @param password The user's password. @throws String if the login fails due to an authentication error.
-
logout(
) → Future< void> - LogoutUser - Valid for any authentication. This method logs out the current user from Firebase Authentication. It handles FirebaseAuthException to provide custom error messages. @throws String if the logout fails due to an authentication error.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyChildrens(
) → void -
inherited
-
onClose(
) → void -
Called before onDelete method. onClose might be used to
dispose resources used by the controller. Like closing events,
or streams before the controller is destroyed.
Or dispose objects that can potentially create some memory leaks,
like TextEditingControllers, AnimationControllers.
Might be useful as well to persist some data on disk.
inherited
-
onInit(
) → void -
Called immediately after the widget is allocated in memory.
You might use this to initialize something for the controller.
inherited
-
onReady(
) → void -
Loads when app Launch from main.dart
This method initializes the Firebase user stream and sets the initial screen based on the user's authentication status.
override
-
refresh(
) → void -
inherited
-
refreshGroup(
Object id) → void -
inherited
-
registerWithEmailAndPassword(
String email, String password) → Future< void> -
EmailAuthentication - REGISTER
Allows users to register using their email and password.
Handles FirebaseAuthException to provide custom error messages.
Parameters:
email
(user's email address),password
(user's password) Throws a String if registration fails due to an authentication error. -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
removeListenerId(
Object id, VoidCallback listener) → void -
inherited
-
sendEmailVerification(
) → Future< void> - EmailVerification - MAIL VERIFICATION This method sends a verification email to the user's email address. It handles FirebaseAuthException to provide custom error messages. @throws String if the email verification fails due to an authentication error.
-
setInitialScreen(
User? user) → Future< void> -
Setting initial screen
This method checks if the user is authenticated and whether their email is verified.
Parameter
user
is the current Firebase user. If the user is authenticated and their email is verified, it navigates to the Dashboard. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
[List< Object> ? ids, bool condition = true]) → void -
Rebuilds
GetBuilder
each time you callupdate()
; Can take a List ofids
, that will only update the matchingGetBuilder( id: )
,ids
can be reused amongGetBuilders
like group tags. The update will only notify the Widgets, ifcondition
is true.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → AuthenticationRepository
-
no setter