connect method

Future connect(
  1. String config,
  2. String name, {
  3. String? username,
  4. String? password,
  5. List<String>? bypassPackages,
  6. bool certIsRequired = false,
})

Connect to VPN

config : Your openvpn configuration script, you can find it inside your .ovpn file

name : name that will show in user's notification

certIsRequired : default is false, if your config file has cert, set it to true

username & password : set your username and password if your config file has auth-user-pass

bypassPackages : exclude some apps to access/use the VPN Connection, it was List

Implementation

Future connect(String config, String name,
    {String? username,
    String? password,
    List<String>? bypassPackages,
    bool certIsRequired = false}) {
  if (!initialized) throw ("OpenVPN need to be initialized");
  if (!certIsRequired) config += "client-cert-not-required";
  _tempDateTime = DateTime.now();

  try {
    return _channelControl.invokeMethod("connect", {
      "config": config,
      "name": name,
      "username": username,
      "password": password,
      "bypass_packages": bypassPackages ?? []
    });
  } on PlatformException catch (e) {
    throw ArgumentError(e.message);
  }
}