I am using the below function to be called on the button press, which updates the data in the backend server. If the function is successful, I want the page to reload and new data to be updated on the page. how should I do that in Flutter?
approvalbutton() async {
var jsonResponse = null;
var response = await http.post(approvalapiurl, body: data);
if (response.statusCode == 200) {
jsonResponse = json.decode(response.body);
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');
String errorcheck = jsonResponse['error'];
if (errorcheck == "false") {
print('success');
}
else {
print('failed');
}
}
}