Sets a callback that will decide whether to accept a secure connection
with a server certificate that cannot be authenticated by any of our
trusted root certificates.
badCertificateCallback: (cert, String host, int port) {
return true;
},
createHttpClient: () {
// Don't trust any certificate just because their root cert is trusted.
final client =
HttpClient(context: SecurityContext(withTrustedRoots: false));
// You can test the intermediate / root cert here. We just ignore it.
client.badCertificateCallback = (cert, host, port) => true;
// Config the client.
client.findProxy = (uri) {
// Forward all request to proxy "localhost:8888".
// Be aware, the proxy should went through you running device,
// not the host platform.
return "PROXY localhost:8888";
};
return client;
},