title: Condition does not work when using a streamBuilder in Flutter
body: <p>I'm trying to implement a screen that displays data from Firebase but I want the <code>streambuilder</code> to check if the database is empty, if it's empty I want it to show a text saying &quot;no data&quot; but if it's not, I want it to show the data from firebase.</p>
  <p>This is the code I have but it does not work as expected, it just shows me a blank screen when there is no data(it works fine when I have data in the database, I just don't want the user to see a blank screen when there is no data).
  Can you advise what is wrong with this code? what is the best way to implement this?</p>
  <pre><code>@override
    Widget build(BuildContext context) {
      double height = responsive.height(context);
      double width = responsive.width(context);
      var stream = Firestore.instance
          .collection('favoritePost')
          .document(widget.currentUserId)
          .collection('favoritePost')
          .orderBy('timestamp', descending: true)
          .snapshots();
      return Scaffold(
        backgroundColor: kBackgroundColorForAllScreens,
        appBar: PreferredSize(
          preferredSize: Size.fromHeight(responsive.height(context) / 20),
          child: SimpleAppBar(
            label: 'Tus Favoritos',
            witdh: responsive.width(context) / 4.7,
            onPressed: () {
              Navigator.pop(context);
            },
          ),
        ),
        body: Column(
          children: &lt;Widget&gt;[
            Expanded(
              child: Container(
                child: StreamBuilder(
                  stream: stream,
                  builder: (context, snapshotPost) {
                    if (snapshotPost.hasData) {
                      return ListView.builder(
                        itemExtent: height / 3.3,
                        itemCount: snapshotPost.data.documents.length,
                        itemBuilder: (BuildContext context, int index) {
                          Reviews reviews = Reviews.fromDoc(
                            snapshotPost.data.documents[index],
                          );
                          Provider.of&lt;UserData&gt;(context).reviews = reviews;
                          return ReviewsMenu(
                            reviews: reviews,
                            user: widget.user,
                            currentUserId: widget.currentUserId,
                            showDialogForDelete: true,
                            comingFromFavorite: true,
                          );
                        },
                      );
                    } else {
                      return Center(
                        child: Text('NO DATA'),
                      );
                    }
                  },
                ),
              ),
            ),
          ],
        ),
      );
    }
  </code></pre>