Auth class

Constructors

Auth.new()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
loggedIn bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

check(String token, {Map<String, dynamic>? user, bool isCustomToken = false}) Future<bool>
Validates and checks the provided token for authentication.
createToken({Duration? expiresIn, bool withRefreshToken = false, bool customToken = false}) Future<Map<String, dynamic>>
Create new token for the given user.
createTokenByRefreshToken(String token, {Duration? expiresIn, bool customToken = false}) Future<Map<String, dynamic>>
Create a new token by given refresh token. The given token must be a valid refresh token. The expiresIn parameter is the duration after which the token will expire. If not provided, the token will expire after 1 hour. The customToken parameter determines if the token should be stored in the database or not. If customToken is true, the token is not stored in the database. Returns a map containing the following keys:
deleteCurrentToken(String token) Future<bool>
Delete the current token for the user that is currently logged in.
deleteTokens(dynamic userId) Future<bool>
Delete all the tokens for the user that is currently logged in.
get(String filed) → dynamic
guard(String guard) Auth
Sets the authentication guard to the specified guard name.
id() → dynamic
login(Map<String, dynamic> user, [bool basic = false]) Auth
Set the current user from a given user object.
logout() Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
user() Map<String, dynamic>

Operators

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