Hello, how can I get user-preferences. I tried to many thing and they just don't work. I have no idea how I could convert a Preference into a string.
TL;DR
To get user preferences, use the provided function. It fetches preferences from the account, checks if the specified key is present, and returns either the value as a string or null. The issue seems to have been resolved already.nvm fixed
TypeScript
Future<String?> getPreference(String prefKey) async {
try {
Preferences prefs = await account().getPrefs();
print(prefs.data.containsKey(prefKey) ? prefs.data[prefKey].toString() : null);
return "done";
} catch (e) {
print('Fehler beim Abrufen der Präferenz: $e');
return null;
}
}```
this is the solution
Recommended threads
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- Magic Link token automatically consumed
Hi, I'm using the Magic Link auth system with Appwrite Cloud and I'm running into huge issues getting users to log in successfully. About 9 times out of 10, th...