Firestore streams not function

20 Views Asked by At

I have an issue, this is my code, the problem is I think is all correct but the stream not display the name, I think also to make the things in the correct mode, was 4 hours that I make that but I can't find a solution, someone can help me?

Here my DB screenshot

DB screenshot

StreamBuilder<QuerySnapshot>(
  stream: FirebaseFirestore.instance.collection('eventi').where('id', isEqualTo: FirebaseAuth.instance.currentUser?.uid).snapshots(),
  builder: (context, snapshot){
    if(snapshot.hasData){
      List utenti = snapshot.data!.docs;

      //List view per il nome - List view for the name
      ListView.builder(
        itemCount: snapshot.data!.docs.length,
        itemBuilder: (context, index) {

          // prendo il signolo utente - Take the single snapshot

          DocumentSnapshot singolo = snapshot.data!.docs[index];

          // // prendo id del documento utente
          // String iDUtente = singolo.id;

          // mappo i dati dalla stream - Mapping the datas
          Map<String, dynamic> dati = singolo.data() as Map<String, dynamic>;
          String nomignolo = singolo['nome'];
          print(nomignolo);

          //mostro nell'interfaccia grafica - Show it on the UI
          return ListTile(
            title: Text(dati['nome']),
          );


        },
      );
    } else if(!snapshot.hasData){
      const Text('In cariacamento...');
    }
    else if (snapshot.hasError){
      print(snapshot.error);
    }
    return Text('Why?');
  },
),
0

There are 0 best solutions below