how can i get username of the user as a string in flutter
account.get() will get the current user. Then, get the name field:
https://appwrite.io/docs/references/cloud/client-web/account#get
thanks
sry im a noob
can u give me a example code
im only getting user as output
it return user-object.. inside that you will see many details...
but, what do you mean by username? do you mean unique identitifer?
yes
Do you have a profiles collection?
Just to give you an idea you'd call toMap() on the returned User object from account.get() then parse the data however you want. A simple example demonstrating what I mean:
final userAccount = await account.get();
final userAccountMap = userAccount.toMap();
final id = userAccountMap["\$id"];
final name = userAccountMap["name"];
final email = userAccountMap["email"];
thank you ur so help
Recommended threads
- Impossible to get USER after createEmail...
Am using provider to deal with functions linked to appwrite. Here is my login. Future<String?> login(String email, String password) async { try { aw...
- Selfhosted Github App installation
I've followed this guide: https://appwrite.io/docs/advanced/self-hosting/configuration/version-control to connect GitHub to my self-hosted Appwrite instance (1....
- User ID case sensitivity
I see that through REST (and SDK as well), getting a user is not case sensitive. And even though documentation does not clearly state that it is, the wording "V...