
can you do something like getPrefs<Map<String, Object>>()
?

no

what's the error?

this method returns io.appwrite.Preferences

So? My suggestion would make it return Preferences<Map<String, Object>>

I had one idea and check this

This gives me a new error

I rewrite code as

Map<String, Object> updatedAccountPrefsMap = (Map<String, Object>) updatedAccountPrefs.getData();
account.updatePrefs(
Objects.requireNonNull(updatedAccountPrefsMap.replace("main_info", newProfileBio)),
...```

and catch io.appwrite.exceptions.AppwriteException: Invalid prefs: Value must be a valid object.

newProfileBio
is a String

Can I use JSONObject?

There's no need to use Objects.requireNonNull()

what happened when you tried getPrefs<Map<String, Object>>()
?

last resort would be to create a new HashMap<String, Object>, add the entries from the existing prefs into it, and then pass it to updatePrefs()

this is false in syntacs

What do you mean?

does getPrefs accept any arguments?

Okay, I've found the time to test it out.
It should be something like this.
// First get the map.
Map<String, Object> map = (Map<String, Object>) pref.getData();
// You can add new pref
map.put("pref", "value");
// You can delete a pref
map.remove("pref");
// You can update pref.
map.replace("pref", "newValue");
// Then, update it
account.updatePrefs(map, /*... */);
It's important you'll do all adding/removing/updating process on a second variable, as none of all those methods will return the object it self.

Yes, this is correct answer! Thank you very much, it's working!

But I have one question about other theme (coding isn't need)

Where can I ask this? (not now)

Create a new post in <#1072905050399191082>

Ok

[SOLVED]How to update Account Preferences with string.
Recommended threads
- Realtime Disconnects and Error: INVALID_...
Hi! I just want to ask here if there's any workaround with the disconnect issues we're encountering when subscribing to realtime events in react native using ex...
- Console is not opening
Plz solve this issue console is not opening
- OAUTH2 doesn't works
https://github.com/202420505/APPWRITE-GOOGLE-AUTH Is my code wrong? I think this is also related to deeplinks
