I\'m trying to create a proxy server that access third-party API, but their development end point have certificate error. Is there anyway to bypass ssl error when using http
Though this question may be out of date, I should still post a short answer for this, in case of someone in the same trouble. This snippet's from my project:
import 'package:http/http.dart' as http;
import 'package:http/io_client.dart';
...
HttpClient client = new HttpClient()..badCertificateCallback = ((X509Certificate cert, String host, int port) => true);
var ioClient = new IOClient(client);
http.Response resp = await ioClient.post(uri, body: utf8.encode(json.encode(body)), headers: headers);
...
The issue was mentioned here and also the fix.