1

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 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

hi, thank you for your reply, I tried printing out data and print also returns old data so Idk whats wrong with the code
i have also tried to delete app , run flutter clean and then reinstall app and problem still exists
after 1 or 2 hours it updates automatically
Glad to hear that everything worked out for you! Please, mark the answer as right if it helped you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.