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
- RowList: The value of total is coming as...
RowList: The value of total is coming as a String, so it throws an error because it’s not parsed into an int. Error: TypeError: \"37\": type 'String' is not a ...
- Auth broken after update from 1.8.0 to 1...
So ive been having issues creating, deleting or updating users on my appwrite instance after i updated from 1.8.0 to version 1.9.0. When trying to create a user...
- User Blocked - False Positive
Today I tried to log in to my cloud console and it said the user is blocked and I didn't even receive any email regarding this like what kind of violation is my...