voidconnect() {
openvpn.connect(
config,
name,
username: username,
password: password,
bypassPackages: [],
// In iOS connection can get stuck in "connecting" if this flag is "false". // Solution is to switch it to "true".
certIsRequired: false,
);
}
Disconnect
voiddisconnect(){
openvpn.disconnect();
}
Publishing to Play Store and App Store
Android
You can use app bundles to publish the app.
Add the following to your files in the android folder (special thanks to https://github.com/nizwar/openvpn_flutter/issues/10). Otherwise, the connection may not be established in some cases and will silently report "disconnected" when trying to connect. This is likely related to some symbols being stripped by Google Play.
gradle.properties > android.bundle.enableUncompressedNativeLibs=falseAndroidManifest > android:extractNativeLibs="true"in the application tag
Add the following inside the android tag in app/build.gradle:
android {
...
//from here ======
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
bundle {
language {
enableSplit = false
}
density {
enableSplit = false
}
abi {
enableSplit = false
}
}
//to here
...
}
Notifications
As the plugin shows notifications for connection status and connection details, you must request permission using third-party packages.
///Put it anywhere you wish, like once you initialize the VPN or pre-connect to the serverPermission.notification.isGranted.then((_) {
if (!_) Permission.notification.request();
});