Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1548

How to make https calls in Flutter?

$
0
0

I am new to flutter development. I am trying hard to make the https calls work. Whenever I call a https URL, it throws the below error:

SocketException: Failed host lookup: 'someserver.com' (OS Error: nodename nor servname provided, or not known, errno = 8)

Below is the code I am using:

final ioc = new HttpClient();    ioc.badCertificateCallback =        (X509Certificate cert, String host, int port) => true;    final http = new IOClient(ioc);    return http        .post(url, body: body, headers: headers, encoding: encoding)        .then((response) {      final String res = response.body;      final int statusCode = response.statusCode;      if (statusCode < 200 || statusCode > 400 || json == null) {        throw new Exception("Error while posting data");      }      return _decoder.convert(res);    });

I have checked below few links and many more and tried all of them but nothing seems to work.

Also please note that I am able to access the server from the browser. Same server is being access from iOS app as well(built using XCode). From iOS I am able to access the server.

Kindly help!


Viewing all articles
Browse latest Browse all 1548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>