Working with users
It's a common task to read or update user information on your server. You can always retrieve the id of a signed-in user through the session object.
var userId = await session.auth.authorizedUserId;
If you sign in users through the auth module, you will be able to retrieve more information through the static methods of the
var userInfo = await Users.findUserByUserId(session, userId!);
UserInfo is automatically populated when the user signs in. Different data may be available depending on which method was used for authentication.
Users class contains many other convenient methods for working with users. You can find the full documentation here.
Displaying or editing user images
The module has built-in methods for handling a user's basic settings, including uploading new profile pictures.
To display a user's profile picture, use the
CircularUserImage widget and pass a
UserInfo retrieved from the
To edit a user profile image, use the
UserImageButton widget. It will automatically fetch the signed-in user's profile picture and communicate with the server.