Home > database >  How do we identify users from firebase and customize the user experience based on the user in a flut
How do we identify users from firebase and customize the user experience based on the user in a flut

Time:12-23

I am building on a flutter application which uses firebase for authentication and firestore database to store users information. And i will be using firebase authentication to authenticate and log the users to the application. I do not have a registration option in my application, so i add users manually using the firebase console (with the email and password).

So now for instance, if i have 5 users in my Firebase console and the 5 users have 5 different names, and i want to retrieve the name of these 5 users and display it once they log into the application.

To be more specific, if User A logins, i want to display the name of User A and if User B logins, i want to display the name of User B and so on.

I've heard that i must create an User model for this, but i don't quite understand how to implement it. (I know we can identify a firebase user by the firebase-UiD though).

So what are the possible ways i can achieve this?

Since i am new to flutter, i have no idea how can i achieve this.

Thank you in advance :)

CodePudding user response:

That's not exactly a flutter implementation

When you add a new user manually or with the SDK implemented, it generates an uid, and the implementation with Firestore really depends on your project, but you can copy that uid and then when you add a new Firestore doc, assign this uid as doc id, like this:

enter image description here

enter image description here

Then you can call that doc using Firestore like this and just parse to your object

enter image description here

  • Related