CustomProxyHttpOverride.withProxy constructor

CustomProxyHttpOverride.withProxy(
  1. String proxyString, {
  2. bool allowBadCertificates = false,
})

Create a new instance of CustomProxyHttpOverride with the specified proxy settings.

A custom HTTP override class that allows setting a global proxy for all HTTP requests.

This class extends HttpOverrides to provide proxy configuration capabilities. It can be used to route all HTTP traffic through a specified proxy server and optionally allow bad certificates for testing purposes.

Example usage:

HttpOverrides.global = CustomProxyHttpOverride.withProxy(
  'localhost:8888',
  allowBadCertificates: true,
);

Important:

  • The proxy string must be in the format "host:port"
  • Allowing bad certificates should only be used for development/testing
  • This affects all HTTP requests made by the application

Note: Use with caution in production environments as it can compromise security if not configured properly.

Implementation

CustomProxyHttpOverride.withProxy(
  this.proxyString, {
  this.allowBadCertificates = false,
});