title: How do i add more items on scroll in the listview?
body: <p>This code here currently loads all the brews that are stored in the Firestore collection.. How can i load initially just 10 brews and then later on when the user scrolls down and reaches to the end of the list of 10 brews..it should load 10 more after the last brew..and the brews should be sorted according to the timestamp.</p>
  
  <pre><code>class BrewList extends StatefulWidget {
    @override
    _BrewListState createState() =&gt; _BrewListState();
  }
  
  class _BrewListState extends State&lt;BrewList&gt; {
    List&lt;Brew&gt; brews = [];
     ScrollController _controller = ScrollController();
  
    @override
    void initState() {
      _startFirst();
      super.initState();
      _controller.addListener(_scrollListener);
    }
  
         _scrollListener() {
      setState(() {
        if (_controller.position.atEdge) {
          if (_controller.position.pixels == 0) {
  
  
          } else {
  
  
  
          }
        }
      });
    }
  
  
  
   _startFirst() async {
      brews = await DatabaseService().brews ?? [];
      setState(() {
        brews = brews;
  
      });
    }
  
    @override
    Widget build(BuildContext context) {
      Future&lt;void&gt; _refreshBrews() async {
        List&lt;Brew&gt; tempList = await DatabaseService().brews;
        setState(() {
          brews = tempList;
        });
        print(brews);
      }
  
  
      return RefreshIndicator(
        onRefresh: _refreshBrews,
        child: ListView.builder(
          controller: _controller,
          itemCount: brews.length,
          itemBuilder: (context, index) {
            return BrewTile(brew: brews[index]);
          },
        ),
      );
    }
  }
  
  
  Future&lt;List&lt;Brew&gt;&gt; get brewss async {
      QuerySnapshot snapshot = await brewsCollection
          .orderBy('timestamp', descending: true)
            .limit(2)
          .getDocuments();
  
      return _postListFromSnapshot(snapshot);
    }
  </code></pre>