Users class

Business logic for handling users.




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


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


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

Static Methods

blockUser(Session session, int userId) Future<void>
Marks a user as blocked so that they can't log in, and invalidates the cache for the user, and signs the user out.
changeUserName(Session session, int userId, String newUserName) Future<UserInfo?>
Updates a users name, returns null if unsuccessful.
createUser(Session session, UserInfo userInfo, [String? authMethod]) Future<UserInfo?>
Creates a new user and stores it in the database.
findUserByEmail(Session session, String email) Future<UserInfo?>
Finds a user by its email address. Returns null if no user is found.
findUserByIdentifier(Session session, String identifier) Future<UserInfo?>
Finds a user by its sign in identifier. For Google sign ins, this is the email address. For Apple sign ins, this is a unique identifying string. Returns null if no user is found.
findUserByUserId(Session session, int userId, {bool useCache = true}) Future<UserInfo?>
Find a user by its id. Returns null if no user is found. By default the result is cached locally on the server. You can configure the cache lifetime in AuthConfig, or disable it on a call to call basis by setting useCache to false.
invalidateCacheForUser(Session session, int userId) Future<void>
Invalidates the cache for a user and makes sure the next time a user info is fetched it's fresh from the database.
unblockUser(Session session, int userId) Future<void>
Unblocks a user so that they can log in again.
updateUserScopes(Session session, int userId, Set<Scope> newScopes) Future<UserInfo?>
Updates the scopes a user can access.