I want to store user information. Right now I created a collection Users with an email, an username and a profile image. I can get all this data using a method Future<CloudUser> getUserDetails({required String userId});. Is it possible to store the username in the class FirebaseAuth.instance.currentUser? so I don’t have to use the method getUserDetails everytime I want to get the username. I am using flutter and firestore.
>Solution :
Is it possible to store the username in the class
FirebaseAuth.instance.currentUser?
You can store the username in the displayName property of the User class.
You can set this value by modifying the user object as shown here in the doc.