title: Flutter pagination with firebase not working for me
body: <p>I tried two posibilities but the firebase data isnt being stored in the products list.The app page returns no data as there is nothing in procucts list. foollowing list returns data succesfully.The second possibilty that i tried and the Consolelog is  in this pastebin link below:
  <a href="https://pastebin.com/DM47YHY6" rel="nofollow noreferrer">https://pastebin.com/DM47YHY6</a></p>
  <pre><code>         List&lt;String&gt; foollowingList = [];
  List&lt;NetworkImage&gt; _listOfImages = &lt;NetworkImage&gt;[];
  List&lt;DocumentSnapshot&gt; products = []; // stores fetched products
  bool isLoading = true; // track if products fetching
  bool hasMore = true; // flag for more products available or not
  int documentLimit = 10; // documents to be fetched per request
  DocumentSnapshot lastDocument; // flag for last document from where next 10 records to be fetched
  ScrollController _scrollController = ScrollController(); /
  void initState() {
    super.initState();
    getFfollowing();
    getPosts();
    _scrollController.addListener(() {
      double maxScroll = _scrollController.position.maxScrollExtent;
      double currentScroll = _scrollController.position.pixels;
      double delta = MediaQuery.of(context).size.height * 0.20;
      if (maxScroll - currentScroll &lt;= delta) {
        getMorePosts();
      }
    });
  
  }
  getFfollowing() async {
    QuerySnapshot snapshot = await followingRef
        .document(currentUser.id)
        .collection('userFollowing')
        .getDocuments();
    setState(() {
      foollowingList = snapshot.documents.map((doc) =&gt; doc.documentID).toList();
    });
  }
  
  getPosts()async{
  
    for( int i=0; i&lt; foollowingList.length; i++) {
      Query q  =  Firestore.instance
          .collection('posts/${foollowingList[i]}/userPosts')
          .orderBy('ownerId')
          .orderBy('timestamp', descending: true)
          .limit(documentLimit);
      setState(() {
        isLoading = true;
      });
      QuerySnapshot querySnapshot = await q.getDocuments();
  
      print(&quot;kjndskjl$products&quot;);
      lastDocument = querySnapshot.documents[querySnapshot.documents.length - 1];
      products = querySnapshot.documents;
      setState(() {
  
        isLoading = false;
      });
    }
  
  }
  getMorePosts()async{
    print('get more called');
    if(hasMore == false){
      return;
    } if(hasMore == true){
      return;
    }
    hasMore = true;
    for( int i=0; i&lt; foollowingList.length; i++) {
          Query q = await Firestore.instance
            .collection('posts/${foollowingList[i]}/userPosts')
            .orderBy('ownerId')
            .orderBy('timestamp', descending: true)
            .startAfterDocument(lastDocument)
            .limit(documentLimit);
          QuerySnapshot querySnapshot = await q.getDocuments();
          if (querySnapshot.documents.length == 0) {
            hasMore = false;
          }
          lastDocument = querySnapshot.documents[querySnapshot.documents.length - 1];
          products.addAll(querySnapshot.documents);
          setState(() {
            hasMore = false;
      print(products);
          });
    }
  
  
  }
  
  buildPosts(){
    return
      Column(children: [
        Expanded(
          child: products.length == 0
              ? Center(
            child: Text('No Data...'),
          )
              : ListView.builder(
            controller: _scrollController,
            itemCount: products.length,
            itemBuilder: (context, index) {
              return
                FutureBuilder(
                  future: usersRef.document(products[index].data['ownerId']).get(),
                  builder: (context, snapshot) {
                    if (!snapshot.hasData) {
                      return circularProgress();
                    }
                    User user = User.fromDocument(snapshot.data);
                    return Column(children: &lt;Widget&gt;[
                      ListTile(
                        leading: GestureDetector(
                          onTap: () =&gt; showProfile(context, profileId: user.id),
                          child: CircleAvatar(
                            backgroundImage: CachedNetworkImageProvider(user.photoUrl),
                            backgroundColor: Colors.grey,
                          ),
                        ),
                        title: GestureDetector(
                          onTap: () =&gt; showProfile(context, profileId: user.id),
                          child: Text(
                            user.displayName,
                            style: TextStyle(
                              color: kText,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                        ),
                        subtitle: GestureDetector(
                          onTap: () =&gt; showProfile(context, profileId: user.id),
                          child: Text(user.username,
                            style: TextStyle(color: kIcon),),
                        ),),
                      cachedNetworkImage(products[index].data['mediaUrl']),
  
                      Divider(color: kGrey,),
                    ],
  
                    );
                  },
                );
  </code></pre>
  <p><img src="https://i.stack.imgur.com/CIG9B.jpg" alt="enter image description here" />![</p>