Back

How to store additional data like phone, location, and address while signing up.

  • 0
  • Databases
  • Flutter
  • Storage
  • Accounts
new user
26 Apr, 2023, 14:21

do i have to use User Preference,

TL;DR
To store additional data like phone, location, and address while signing up, you can use the User Preference feature. This allows you to store small amounts of data with a limit of 64KB in total size. To implement this, create a function that listens to the user creation event and use the `updatePrefs` function to store the data. You can also use the `getPrefs` function to retrieve the preferences and the `updatePrefs` function to update them later on. If the amount of data exceeds the 64KB limit, it is recommended to create another collection.
Binyamin
26 Apr, 2023, 14:22

If its just small amount of information, then yes use the User Preference. But the User Preference has limit of 64KB for the total size, so if it bigger then that creating anouthr collection would be the best

new user
26 Apr, 2023, 14:28

yes its a small amount of data like three or four field with 50 words each

Binyamin
26 Apr, 2023, 14:29

So User Preference well suit you

new user
26 Apr, 2023, 14:29

as i go through doc but not found how to implement.

Binyamin
26 Apr, 2023, 14:31

To get the preference https://appwrite.io/docs/client/account?sdk=web-default#accountGetPrefs

To update https://appwrite.io/docs/client/account?sdk=web-default#accountUpdatePrefs

So you would do something like this

TypeScript
  const prefs = await account.getPrefs();

  prefs['phone'] = '1234';

  await account.updatePrefs(prefs);
new user
26 Apr, 2023, 15:28

but how to create while sign up

Binyamin
26 Apr, 2023, 15:29

For that create a function the listen to the event of user creation and then do something like this

TypeScript
users.updatePrefs('[USER_ID]', {});
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more