title: Summation problem in flutter is not working, How can I show the total income in navigation bar?
body: <p>I want to sum the field (total income in January) of all document under the collection name (&quot;januaryi&quot;).I tried a function that is not working. Is there any way to call function and show summation in bottom navigation bar.</p>
  <p><strong>Flutter Firebase:</strong></p>
  <p><img src="https://i.stack.imgur.com/s9e5t.png" alt="Valid XHTML" /></p>
  <p><strong>Function:</strong></p>
  <pre><code>class _JanuaryState extends State&lt;January&gt;{
    totalmoney() async {
     int total = 0;
     var snapshot = 
         await Firestore.instance.collection(&quot;Januaryi&quot;).getDocuments();
     if (snapshot == null){
       return 0; 
     }
     snapshot.documents.foreach((doc) {
       total = total + int.parse(doc.data['income']);
     });
     return total;
   }
  }
  </code></pre>
  <p><strong>Bottom Navigation Bar:</strong></p>
  <pre><code>  bottomNavigationBar: Container(
       child: ListTile(
       title: Text('Total'),
       subtitle: Text(&quot;${totalmoney()}&quot;),
      )),
    );      
  </code></pre>
  <p><strong>Showing error in total income:</strong></p>
  <p><img src="https://i.stack.imgur.com/qdR2U.png" alt="Valid XHTML" /></p>