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
- Previous ession
Hi, implementing authentication via email and password I found myself in a dilemma: once logged in and then created a session, if I immediately delete the app a...
- Email Verification URL
Hi, I've been working on a react native project using appwrite and saw that you can sign in without verifying your email. I then fell upon Email Verification, w...
- Can send phone authentication requests f...
I am running phone authentication on my website and when I try to Send OTP it is going fine when I do it on any browser on PC but when I do it on phone it's giv...