Network request | Flutter listview not updating after data update [solved]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone here we'll see if you add a  task and send it to the server and you want to   read back from the server and you'll see that  a lot of time your data doesn't get updated   so let's go ahead and add a new task and  see how to solve this so i'll add a task so now here i'll add a new task and this is  the fourth task that i'm going to use it'll   send it back to the server and once i read it  back i'll still see that i have three on the   front ends so let's go ahead and print it now  as you see over here we are getting three tasks   okay and here it also said that uh we didn't  we we posted the data successfully which is uh   coming from here okay so status code 200 posted  data now if i reload my app i'll still see that   now i have this fourth one that i added  and i see over here that we have four data   but it didn't get updated immediately why not  okay so that's because over here uh even though   i loaded the data but it returned immediately  it didn't wait for the data to be returned   and over here it just did the build  okay so now i'll take this auto build   and over here i'll create a new method now  i created a new method over here and i call   it load data and over here i have this await and  async keyword now i will call this one from here   now with this uh after submitting the data to the  server once i hit this url or this file so then it   will find this function and it will wait until it  gets the new data once it gets the new data then   it will reload everything from the server and  then do the ui okay so here a sync and a wait   they are doing the job okay so if you miss a  singer await a lot of time you'll see that your   data is not updated even though data actually  was there but your ui didn't wait for the data   to be updated so we need to use a weight and a  sync so what did it do it let the ui know okay   i need data and data is coming from the server  and wait for me okay otherwise this function if   you just write like this it would get executed  too fast so ui just go and go ahead and does the   building or redraw the ui okay so we need to wait  for all the data that comes from the server okay   now if i go ahead and add a new task over here  right now p or get x okay now i'll hit this one   and i will see over here it updated immediately  okay so that's how you wait and update your data
Info
Channel: dbestech
Views: 11,582
Rating: undefined out of 5
Keywords: flutter listview, Flutter listview not updating after data update, upldate listview data, why listview is not updating data, flutter getx listview data update, create and update list from network api
Id: q2vUKcrL5CI
Channel Id: undefined
Length: 2min 57sec (177 seconds)
Published: Thu Mar 31 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.