This is a great video, the whole process is very well explained and makes streams, something that I'm struggling with, super straightforward. It's exactly what I was looking for. Keep up the videos!
Every infinite loading tutorials has the same issue. It checks if the maxScrollExtent is reached. But if you don't scroll to the last pixel, it won't load anything new. My idea is to load more data, if I create the CircularProgressIndicator in the last cell. This would be the much more elegant solution, in my opinion.
Peter, i'm not sure, right deсision or not, but in my case i check itemIndex in listview builder, and if itemIndex > data.length - 5, i upload new batch of data
Wow. U did a great tutorial !!! You r right. Most of the tutorial out there put all the things together. Your tutorial is what want. Thank you very much
Hi David, I'm dealing with a similar issue but I can't manage to get the desired result without a lil hack. So in this tutorial, you're controlling the flow of the stream. The stream isn't changing, you're manually loading data into the stream. I've attached my streambuilder to a firestore document. And when you reach the bottom of the list it changes the variable of the stream. (limit 20 => 40 for examples). And this naturally wipes all data and attaches to a new listener. Which causes it go to top of the list, which i then have to control using a scroll controller after loading to bring back to position. It works. But I want to know if you can suggest an improvement?
Hi Gihan - all you need to do is to have a function that returns Future Read through this article, specifically on section 3 which walks through changing the response structure: flutter.dev/docs/cookbook/networking/fetch-data
This is really great. I have one question: Does the stream builder fetch all the data from a server? Let's say I have an API endpoint that returns 1000 posts, How StreamBuilder will do it such a way that the application will only fetch 30, then 60, ......?
The listview.builder will only render what's visible (plus a couple off screen for speed). If your API is paginated then you can make a new request as you scroll.
Can you also make the same tutorial with firebase this time? It would be really helpful. I tried implementing the firebase in the _getExampleServerData but the firebase query returns Future
Refresh on top also scrolls automatically "scrolls"?! In a chat or similiar history would be "the update". So in this scenario its not an update and we actually just want to "append" it. How is this possible?
Sir, can u please share the code of this procedure with API. you replied to one comment but it is still confusing. because flutter documentation uses Model.fromJson but you are using Model.fromServerMap. It will be very helpful if you share the code.