I use flutter to build a web application. When I send a request to my localhost server IP address, or send a request to a host without HTTPS
(SSL Certificate), I got XMLHttpRequest error
. I searched about that and any user says to add CORS
on the server-side and add some headers to request and server, But my server and request have that. I think XMLHttpRequest error
is for the SSL Certificate of my host. In mobile, we can use some library like restio and add verifySSLCertificate: false
to request and ignore that. But I don't know how to send requests without error in flutter web. Can you help me?
My code for send a simple request and got that error:
var client = http.Client();
String theUrl = 'http://192.168.1.9/index.php/get_items';
var response = await client.get(Uri.parse(theUrl));
print(response.body);