parsing JSON returns old data

Viewed 46

so I have some database on hosting, I created a PHP script to make this data accessible for my flutter app, so now I'm accessing this data like this.[![enter image description here][1]][1]

getMethod() async {
String theUrl = 'https://tchakrulo.space/getData.php';
var res = await http
    .get(Uri.parse(theUrl), headers: {'Accept': 'application/json'});
var responseBody = await json.decode(res.body);

return responseBody;

}

everything works fine except when I'm adding a new entry or updating an existing one somehow my app still returns old data, even after restarting the app, so I want to get new data from json, every time the page loads

1 Answers

Perhaps your values ​​are somehow cached, so if I were you, I would enter the command "flutter clean" into the console and remove the application from your device / emulator, and then reinstall it, if the problem persists, then you probably have a mistake in the code, double-check the correctness of the queries, as well as using the command print("Value: " + value.toString()); to check the values ​​that you get through the console, try to track the path along which the values ​​​​go and you will understand everything. All I can do is just give you an algorithm for solving your problem.

Related