Custom User Data - Flutter SDK
On this page
You can store arbitrary custom data about your users with Atlas App Services. For example, you might store a user's preferred language, date of birth, or local timezone. Before writing and reading this data, you must enable custom user data in the backend. To learn more, see Enable Custom User Data.
Currently you can only read custom user data with the Flutter SDK. In a future update to the SDK, you will be able to write custom user data from the SDK as well.
You can create, update, or delete custom user data using one of the other Realm SDKs, with App Services functions, or by directly querying MongoDB Atlas.
Before You Begin
To use custom user data, you must first enable custom user data on the Atlas App Services:
Read a User's Custom User Data
You retrieve custom user data in the User.customData property of a logged in user:
final customUserData = user.customData;
Atlas App Services does not dynamically update the value of the
User.customData
immediately when underlying data changes. Instead, Atlas App Services
fetches the most recent version of custom user data whenever a user
refreshes their access token or when you explicitly
call User.refreshCustomData(),
which ensures your app has the latest custom user data.
// refreshCustomData() returns the updated custom data object final updatedCustomData = await user.refreshCustomData(); // Now when you access User.customData it's the value // returned from User.refreshCustomData()