I wanted to make a query I have an Api that does GET POST AND PUT. My question, on flutter:
I must always call them as a FUTURE to my methods that do GET or POST or PUT. I have tried them without putting them and it works "Normal".
I also saw that some recommend using FUTURE in conjunction with FUTURE BUILDER to create the widgets. I have tried without using any of the 2 and it works "Normal".
How should this scenario work where I combine update and read to my database from my API. I have been doing it like this I READ MY URL WITH THE DATA and show it on my screen, then with a button I call the method of my API that consults the states of those records (I get those states from another external API) and within this method that reads the states I call the method that does the UPDATE to update those states obtained in my database and within this same method I call the first method that showed me the documents (the one I initially use to show them on the mobile) but already with the "updated states". The Detail that returns me with the old states sometimes returns me some, for example there were 20 and it only shows me 5 (the other 15 have already updated their current state), with which I could conclude that my query method is carried out before it finishes updating the states. How can I control that?
I hope any comment or help on how to work correctly on those points thank you very much
Example:
In the situation of using FutureBuilder, I would say that it depends on the project (widget, view) that is going to be created, you can skip using the FutureBuilder, but in return you will have to have a good state management. You will need to:
I don't quite understand what you mentioned at this point, but what I can say is that it can happen if you're not using Future and await. What you should do is call your first API, use await and make the second call, also with an await and so the application waits until the information is complete.