AuthenticationService<User> class
abstract
A base class representing an Authentication Service for a Flutter application.
This class provides methods for various authentication functionalities including sign-in, sign-out, user creation, password reset, and token refresh. It also offers streams to listen for changes in authentication state (user) and token updates.
Subclasses are expected to implement the logic for these methods based on their specific authentication provider (e.g., Firebase Authentication, custom backend).
Constructors
Properties
-
authState
→ Stream<
User?> -
A stream that provides updates on the current authenticated user,
or null if not authenticated.
no setter
-
authStateChangeController
→ StreamController<
User?> -
A broadcast StreamController that emits updates whenever the user's authentication state changes.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tokenChangeController
→ StreamController<
String?> -
A broadcast StreamController that emits updates whenever the authentication token changes.
final
-
tokenState
→ Stream<
String?> -
A stream that provides updates on the current authentication token.
no setter
- user → User?
-
Returns the currently authenticated user, or null if not authenticated.
no setter
Methods
-
confirmPasswordReset(
String code, String newPassword) → Future< void> - Confirms a password reset using the provided code and new password.
-
createUser(
String email, String password) → Future< void> - Creates a new user account with the provided email and password.
-
dispose(
) → Future< void> - Disposes of the stream controllers to avoid memory leaks.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshToken(
User user) → Future< void> - Refreshes the authentication token for the currently signed-in user.
-
resetPasswordReset(
String email) → Future< void> - Initiates the password reset process by sending a reset email to the provided address.
-
sendResetPasswordEmail(
String? email) → Future< void> - Sends a password reset email to the provided address (optional).
-
signIn(
String email, String password) → Future< void> - Signs in a user with the provided email and password.
-
signOut(
) → Future< void> - Signs out the currently authenticated user.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited