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
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Upsert with setting permissions
Hi there, I am using self-hosted appwrite v1.7.4 and trying to use the bulk update stuff that was released with 1.7.x. Unfortunally I found that there is an ser...
- Github connection error - Self Hosted Ap...
I am trying to connect my github account to deploy a project to sites, but Connect to Gtihub button is disabled. I have configured all Env variables needed for...