I'm developping a crowfunding application with flutter. The first step I've done (after firebase integration to my app) is the login page (login with google) and it works correctly.

In the firebase dashboard I can see the number of users logged and their activity, but I can't see their details (eg. their name, surname and google mail). Is it possibile to track these data in firebase dashboard? If it is yes, how can I do it?

Thanks


Solution 1: Lucas Baggio

To save other details, for example: name, age, gender.

First you need to create a Model for this User.

In the sign up process, you need to save this information using Firestore.

I will put below a code for example:

In the example, it is an Uber style app and I want to retrieve the user's name mainly and I want to know its type, whether it is a driver or a passenger.

Sign up Screen

I am using the form of registration only with email / password, but it makes no difference, after registering, see the code below, in the ".then", is where the data is passed to the Firestore

 void cadastrarUser(Usuario usuario) {
FirebaseAuth auth = FirebaseAuth.instance;
FirebaseFirestore db = FirebaseFirestore.instance;
auth
    .createUserWithEmailAndPassword(
        email: usuario.email, password: usuario.senha)
    .then((firebaseUser) {
  db.collection("usuarios").doc(firebaseUser.user.uid).set(usuario.toMap());

  switch (usuario.typeUser) {
    case "motorista":
      Get.toNamed("/painel-motorista");
      break;

    case "passageiro":
      Get.toNamed("/painel-passageiro");
      break;
  }
}).catchError((error) {
  errorMessage =
      "Erro ao cadastrar usuário, verifique os campos e tente novamnte!";
});

This method receives a User instance, to transfer this data from the User instance, you need to convert this object into a "map".

In the model, you need create a method for this conversion, see the example below:

    class Usuario {
  String _idUser;
  String _nome;
  String _email;
  String _senha;
  String _typeUser;

  Usuario();

  String checkTypeUser(bool typeUser) {
    return typeUser ? "motorista" : "passageiro";
  }

  Map<String, dynamic> toMap() {
    Map<String, dynamic> map = {
      "nome": this.nome,
      "email": this.email,
      "typeUser": this.typeUser
    };
    return map;
  }