CustomProxyHttpOverride class final

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.

Inheritance
Annotations

Constructors

CustomProxyHttpOverride.withProxy(String proxyString, {bool allowBadCertificates = false})
Create a new instance of CustomProxyHttpOverride with the specified proxy settings.

Properties

allowBadCertificates → bool
Set this to true
final
hashCode → int
The hash code for this object.
no setterinherited
proxyString → String
The entire proxy server Format: "localhost:8888"
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

createHttpClient(SecurityContext? context) → HttpClient
Override HTTP client creation to set the proxy and bad certificate callback.
override
findProxyFromEnvironment(Uri url, Map<String, String>? environment) → String
Resolves the proxy server to be used for HTTP connections.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited