title: Check if ListView.builder returns only empty Containers
body: <p>I am having a list presented by a ListView.builder and I use a Function to check if an object in the list is being searched, but I want to present a screen when no object was found. So the user knows that nothing was found but I am strugelling with it, the code looks something like that:</p>
  <pre><code>Container OnlyShow = Container(
      child: ListView.builder(
        itemCount: myList.length,
        itemBuilder: (context, index) {
          if (searchfunction(myList[index]) == true) {
            return myListObject(myList[index]);
          } else {
            return Container(height: 0, width: 0,);
          }
        },
      ),
    );
  </code></pre>
  <p>The search function itself is not the problem I only want to know how I could find out if the ListView.builder only returns empty containers, because that would mean that no objects equal the search and therefore nothing was found.</p>
  <p>I have tried something like that:</p>
  <pre><code>Container OnlyShow = Container(
      child: ListView.builder(
        itemCount: myList.length,
        itemBuilder: (context, index) {
          if (searchfunction(myList[index]) == true) {
            if (howManyObjectsAreFalse &gt; 0) {
              howManyObjectsAreFalse--;
              dismissNoResultsFoundScreen();
            }
            return myListObject(myList[index]);
          } else {
            if (howManyObjectsAreFalse &lt; myList.length) {
              howManyObjectsAreFalse++;
            }
            if (howManyObjectsAreFalse == myList.length) {
              showNoResultsFoundScreen();
            }
            return Container(height: 0, width: 0,);
          }
        },
      ),
    );
    
    int howManyObjectsAreFalse = 0;
  </code></pre>
  <p>It should work like this when an empty Container is returned the count is incremented and when a Result is returned the count is decreased, So when the count hits the length of the list the NoResultScreen is being presented.</p>
  <p>It does work but with some weird exceptions, sometimes the count seems to fluctuate between to values, even if the ListView.builder only returns empty Containers.</p>
  <p>Note: The List is not empty I just return an empty container for every object in the list that is not equal to the search value. So I don't decrease the list or something</p>
  <p>I hope someone can help me with a better way to achieve this.</p>