setProxy method

  1. @override
Future<String?> setProxy(
  1. String host,
  2. int port
)
override

Sets a proxy for network communication.

  • host: The host of the proxy server.
  • port: The port number for the proxy server.

Returns a String indicating the result of the proxy configuration process.

Implementation

@override
Future<String?> setProxy(String host, int port) async {
  try {
    String value = await methodChannel
        .invokeMethod('set-proxy', {"host": host, "port": port});
    return Future.value(value);
  } catch (e) {
    return Future.error(e);
  }
}