
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
- Apple OAuth in SwiftUI
Any ideas why this error might be showing up when trying it sign in via apple in SwifUI? _Concurrency/CheckedContinuation.swift:196: Fatal error: SWIFT TASK CO...
- Unexpected File Persistence Across Appwr...
I'm encountering an issue where files created during an Appwrite Function execution persist across subsequent executions. Specifically, when a function writes a...
- Cannot connect to SMTP in AppWrite - set...
This used to work and then at some point it stopped. One thing that happened in that time was moving my application to Vercel. I have read on another thread t...
