plushteddy
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. plushteddy
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
- Error When load the website
Hi, I am getting this error whenever I reload my website please help me, I am using react Error: ** GET https://cloud.appwrite.io/v1/account 401 (Unauthoriz...
- Migrate from cloud to localhost
Hello everyone. I need to migrate my test project from cloud to localhost, however it seems that this is possible only if a self-hosted appwrite instance it's h...
- Current User is Not authorized
recreating same Thread