LocalAuthProvider class
In-memory auth provider for local development and tests.
Credentials are really stored and really verified: passwords are salted and hashed with DVPasswordHasher, an unknown account or a wrong password is rejected, and accounts cannot be silently overwritten. It holds everything in memory and has no account recovery, e-mail verification, or session expiry, so it remains a development and test adapter — configure a real AuthProvider for production.
- Implemented types
Constructors
- LocalAuthProvider({DVPasswordHasher? hasher})
Properties
-
accounts
→ List<
String> -
Registered account e-mails, for test assertions and dev tooling.
no setter
-
authStateChanges
→ Stream<
AuthUser?> -
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
changeEmail(
String id, String email) → Future< AuthUser> -
Moves the account with
idtoemail. Throws AuthException with AuthFailure.accountExists when another account has that address and AuthFailure.invalidEmail when it is not one.override -
changePassword(
String id, String password) → Future< void> -
Sets the password of the account with
id. Throws AuthException with AuthFailure.weakPassword for a password the provider will not keep.override -
currentUser(
) → Future< AuthUser?> -
override
-
deleteAccount(
String id) → Future< void> -
Removes the account with
id. Its credentials no longer sign in.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Removes every account and signs out. Intended for test teardown.
-
signIn(
String email, String password) → Future< AuthUser?> -
Signs in, or throws AuthException.invalidCredentials whether the
account is missing or the password is wrong, after the same work.
override
-
signOut(
) → Future< void> -
override
-
signUp(
String email, String password, {String? name}) → Future< AuthUser?> -
override
-
toString(
) → String -
A string representation of this object.
inherited
-
userById(
String id) → Future< AuthUser?> -
The account with
id, or null when there is none.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- minimumPasswordLength → const int