AuthManager<T extends Token> class

Manages stateful authentication information such as the currently authenticated user and relevant authentication headers.

Constructors

AuthManager({required AuthClient<T> client, required AuthPersistence<T> persistence})

Properties

client AuthClient<T>
final
currentUser Stream<AuthUser<T>?>
Stream that emits the currently logged-in user, or null if no user is logged in.
latefinal
currentUserValue AuthUser<T>?
The currently logged-in user, or null if no user is logged in.
no setter
hashCode int
The hash code for this object.
no setterinherited
persistence AuthPersistence<T>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addLogoutCallback(LogoutUseCase<T> callback) bool
Add a callback that will be triggered before the user is logged-out.
close() → void
Closes the authentication manager and releases any resources.
getAuthHeader() Future<MapEntry<String, String>?>
Returns authentication headers for the current user, or null if there is no current user.
logIn({String? email}) Future<void>
Log in and set the resulting user as the current user.
logOut() Future<void>
Log the current user out. The current user value will be set to null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerTokenErrorHandler(TokenErrorHandler handler) bool
Register a callback that can handle token errors during login or reauthentication
removeLogoutCallback(LogoutUseCase<T> callback) bool
Remove a callback that was added via addLogoutCallback.
toString() String
A string representation of this object.
inherited
unregisterTokenErrorHandler(TokenErrorHandler handler) bool
Unregister a token error handler that was previously registered with registerTokenErrorHandler.

Operators

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