AuthManager<T> class
abstract
This is the base class to store the authentication state and credentials of the application.
Extend this class to implement your own authentication logic. You can store the authObject in any db of your choice, in a FlutterSecureStorage, or in memory if you don't want to persist it.
Constructors
- AuthManager()
-
const
Properties
- authObject → T?
-
no setter
-
authStateChanges
→ Stream<
bool> -
authStateChanges is used to listen to the authentication state of the app.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAuthenticated → bool
-
isAuthenticated is used to check the authentication state of the app.
Generally, this would check the value of authObject to return the state
of authentication.
no setter
- parsedAuthObject → String
-
Returns String type authObject in a format that can be used in the
Authorization
header of a request.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
authenticate(
T authObject) → Future -
authenticate is used to store the
authObject
and update the isAuthenticated state totrue
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
synchronize(
) → Future - synchronize is used to ensure that the authObject is correctly synced. Call and await this once in the app lifetime to ensure correct value from isAuthenticated and authObject
-
toString(
) → String -
A string representation of this object.
inherited
-
unauthenticate(
) → Future -
unauthenticate is used to delete the authObject and update the
isAuthenticated state to
false
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited