
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
- Functions fail to deploy after switching...
Hi <@1087889306208718959> , after switching my self-hosted Appwrite instance to use AWS S3 as the storage backend, my Cloud Functions stopped working. I’m runni...
- must be a valid domain or hostname
I have just migrated from 1.6.0 to 1.7.4. Upon migration I can log in but then get this screen. I also get this error in docker. Don't know if anyone has any id...
- Retrieving user access token on client s...
I am trying to retrieve the user token from the cookies, but they are HTTP-only and can not be accessed. Is there a way to extract the user token from the cooki...
