title: failing to check if document retrieved from cloud firestore database has data or not
body: <p>I am retrieving data fro my Firestore and I can't seem to get my code to work. I want it to display something when it can't find data in the collection I gave it......................................................................................................................................................</p>
  <p>Here is my code:</p>
  <pre><code>     StreamBuilder( 
                        stream: Firestore.instance.collection(&quot;payments&quot;).where('participants', arrayContains: userActive).snapshots(),
                        builder: (context, snapshot){
  
  
                          
                       
  
                        return Container ( child:ListView.builder(
                            shrinkWrap: true,
                          itemCount: snapshot.data.documents.length,
                          padding: EdgeInsets.all(0),
                          controller: ScrollController(keepScrollOffset: false),
                          itemBuilder: (context, index){
  
                             DocumentSnapshot documentSnapshot = snapshot.data.documents[index].data();
  
                            if(snapshot.data.documents.isEmpty){
  
                                 print(&quot;No Data!!!&quot;);
  
  
                            }else{
  
  
                              print(&quot;Found Data!!!&quot;);
                            }
  
                       /*   if(documentSnapshot[&quot;receiver_name&quot;] == userActive )  {         
                                                              
  
                                                                
                              return Container(
                              margin: EdgeInsets.symmetric(horizontal: 32,vertical: 5),
                              padding: EdgeInsets.all(16),
                              decoration: BoxDecoration(
                                color: Colors.white,
                                borderRadius: BorderRadius.all(Radius.circular(20))
                              ),
                              child: Row(
                                children: &lt;Widget&gt;[
                                  Container(
                                    decoration: BoxDecoration(
                                        color: Colors.grey[100],
                                        borderRadius: BorderRadius.all(Radius.circular(18))
                                    ),
                                    child: Icon(Icons.attach_money, color: Colors.lightBlue[900],),
                                    padding: EdgeInsets.all(12),
                                  ),
  
                                  SizedBox(width: 16,),
                                  Expanded(
                                    
                                    child: Column(
  
  
                                      crossAxisAlignment: CrossAxisAlignment.start,
                                      children: &lt;Widget&gt;[
                                        
                                      Text(&quot;Recieved&quot;, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Colors.grey[900]),) ,
  
                                      
                                     
                                        Text(&quot;&quot; + documentSnapshot[&quot;currency_received&quot;] + documentSnapshot[&quot;amount_received&quot;], style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: Colors.grey[500]),),
                                     
  
                                     
                                       
                                                                        
                                     
                                      ],
                                    ),
                                  ),
  
                                  Column(
                                    crossAxisAlignment: CrossAxisAlignment.end,
                                    children: &lt;Widget&gt;[
  
                                      
  
  
                                      Text(&quot;+ &quot; + documentSnapshot[&quot;currency_sent&quot;] + documentSnapshot[&quot;amount_paid&quot;].toString(), style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Colors.lightGreen),),
  
  
  
                                  
   Text(documentSnapshot[&quot;date&quot;].toDate().toString(), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: Colors.grey[500]),),                                
                                    ],
                                  ),
                                ],
                              ),
                            );
  
  
                        } else if (documentSnapshot[&quot;sender_name&quot;] == userActive){
  
  
  
                       return Container(
                              margin: EdgeInsets.symmetric(horizontal: 32,vertical: 5),
                              padding: EdgeInsets.all(16),
                              decoration: BoxDecoration(
                                color: Colors.white,
                                borderRadius: BorderRadius.all(Radius.circular(20))
                              ),
                              child: Row(
                                children: &lt;Widget&gt;[
                                  Container(
                                    decoration: BoxDecoration(
                                        color: Colors.grey[100],
                                        borderRadius: BorderRadius.all(Radius.circular(18))
                                    ),
                                    child: Icon(Icons.attach_money, color: Colors.lightBlue[900],),
                                    padding: EdgeInsets.all(12),
                                  ),
  
                                  SizedBox(width: 16,),
                                  Expanded(
                                    
                                    child: Column(
  
  
                                      crossAxisAlignment: CrossAxisAlignment.start,
                                      children: &lt;Widget&gt;[
                                        
                                      Text(&quot;Sent&quot;, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Colors.grey[900]),) ,
  
                                      
                                     
                                        Text(&quot;&quot; +  documentSnapshot[&quot;currency_received&quot;] + documentSnapshot[&quot;amount_received&quot;], style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: Colors.grey[500]),),
                                     
  
                                     
                                       
                                                                        
                                     
                                      ],
                                    ),
                                  ),
  
                                  Column(
                                    crossAxisAlignment: CrossAxisAlignment.end,
                                    children: &lt;Widget&gt;[
  
                                      
  
  
                                      Text(&quot;- &quot; + documentSnapshot[&quot;currency_sent&quot;] + documentSnapshot[&quot;amount_paid&quot;].toString(), style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Colors.orange),),
  
  
  
                                  
                                                   Text(documentSnapshot[&quot;date&quot;].toDate().toString(), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: Colors.grey[500]),),
                                  
                                    ],
                                  ),
                                ],
                              ),
                            );
  
  
  
  
  
  
  
  
                          
                   
  
  
  
                        }else{
                                      
                                          
                                          return Text(&quot;Nothng found &quot;,style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: Colors.black));
                        }
  
  
  */
                                                              
                         
                          
  
                          },
                         )
                        );
                          
   }
   
  
  
  
    
     ),
                   
  </code></pre>