Package selection guidance compiled from public package information, community data, and project usage.
The openvpn_flutter package enables Flutter applications to connect to OpenVPN services on Android and iOS platforms. It provides a straightforward interface for managing VPN connections, allowing users to establish secure network tunnels programmatically. The plugin integrates native OpenVPN libraries, ensuring compatibility with standard OpenVPN configurations and .ovpn files. It is designed for developers seeking to add secure connectivity features to their apps, such as private network access or enhanced data protection.
Use cases
Secure app-to-server communication
Private network access in enterprise apps
Enhanced user data privacy
Bypassing regional content restrictions
Connecting to corporate VPNs
Key features
Supports Android and iOS platforms
Integration with standard .ovpn configuration files
Programmatic connection management
Secure tunnel establishment
Lightweight and easy to integrate
Suitable for
Enterprise mobile applications
Apps requiring secure network access
Developers building privacy-focused tools
Applications needing remote server connectivity
Projects using OpenVPN infrastructure
Considerations
Requires native OpenVPN library integration
May need additional permissions on Android and iOS
Configuration file handling must be secure
Limited to OpenVPN protocol
Platform-specific setup may be required
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Connect to the OpenVPN service using Flutter. Contributions through issues and pull requests are highly appreciated!
Android Setup
1. Permission Handler
Java
Include the following code in the onActivityResult method of MainActivity.java (if you are using Java):
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();
});