Skip to content

Instantly share code, notes, and snippets.

@marcinOz
Created July 17, 2020 17:11
Show Gist options
  • Save marcinOz/9b2197ab5fe4143427426de226907992 to your computer and use it in GitHub Desktop.
Save marcinOz/9b2197ab5fe4143427426de226907992 to your computer and use it in GitHub Desktop.
void checkForCharlesProxy(Dio dio) {
const charlesIp =
String.fromEnvironment('CHARLES_PROXY_IP', defaultValue: null);
if (charlesIp == null) return;
debugPrint('#CharlesProxyEnabled');
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.findProxy = (uri) => "PROXY $charlesIp:8888;";
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment