CustomProxy class

A class that manages custom proxy settings for Flutter applications.

This class provides functionality to set up and manage a proxy server configuration, including the ability to enable/disable the proxy and handle custom certificates.

Example usage:

final proxy = CustomProxy(ipAddress: '192.168.1.1', port: 8080);
proxy.enable(); // Enables the proxy
proxy.disable(); // Disables the proxy

You can also create a proxy instance from a string:

final proxy = CustomProxy.fromString(proxy: '192.168.1.1:8080');

The class supports:

  • Setting custom IP address and port
  • Enabling/disabling proxy settings
  • Optional bad certificate handling
  • String representation of proxy settings

Note: When allowBadCertificates is set to true, it may pose security risks and should be used with caution, especially in production environments.

Annotations

Constructors

CustomProxy({required String ipAddress, int? port, bool allowBadCertificates = false})
A class that manages custom proxy settings for Flutter applications.
const

Properties

allowBadCertificates bool
Set this to true
final
hashCode int
The hash code for this object.
no setterinherited
ipAddress String
A string representing an IP address for the proxy server
final
port int?
The port number for the proxy server Can be null if port is default.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

disable() → void
Disables the global HTTP proxy settings by setting HttpOverrides.global to null.
enable() → void
Enables the custom proxy by setting a global HTTP override.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

fromString({required String proxy}) CustomProxy?
Creates a CustomProxy instance from a string representation.