Rank 1: Thread
how can i get username of the user as a string in flutter
Votes
0
Replies
10
Participants
Unknown
Messages
11
Rank 1: Thread
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
Rank 1: Thread
thanks
Rank 1: Thread
sry im a noob
Rank 1: Thread
can u give me a example code
Rank 1: Thread
im only getting user as output
Rank 5: Hypervisor
it return user-object.. inside that you will see many details...
but, what do you mean by username? do you mean unique identitifer?
Rank 1: Thread
yes
Do you have a profiles collection?
Rank 3: Container
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"];Rank 1: Thread
thank you ur so help