I'm using time API in my flutter application through http package :
var url = Uri.parse(
'https://www.timeapi.io/api/Time/current/zone?timeZone=Europe/Italy');
var responseDateTime = await http.get(secondUrl, headers: {
"Accept": "application/json",
"Access-Control-Allow-Origin": "*"
});
var responseDateTimeBody =
jsonDecode(responseDateTime.body) as Map<String, dynamic>;
this method works well on android and I can read json response in my app however I've got this XMLHttpRequest error. after migrate to flutter web , how can I solve this ?
I've already read these responses to fix XMLHttpRequest
error on flutter web:
Dart/Flutter: Http request raises XMLHttpRequest error
How to solve flutter web api cors error only with dart code?
and my error was fixed locally using these suggestions; however, it persists in the production app; how do I fix it for the final product?