Skip to content
pubscout

openvpn_flutter

2.0.0, released 4 weeks ago by nizwar.dev

Connect to OpenVPN servers from Flutter on Android, iOS and macOS.

WASM-readyCopyleft license
$ flutter pub add openvpn_flutter
Source repository

What it does

Allows Flutter applications to establish and manage OpenVPN connections on Android, iOS, and macOS. It provides native engines, stage, traffic, and log streams, per-app VPN routing, and session timeouts.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to build a VPN client application supporting Android, iOS, and macOS.
  • You require advanced OpenVPN features like per-app VPN or encrypted private keys.

Skip it when

  • You only need standard HTTP/REST API calls and do not require a VPN tunnel.

Strengths

  • Cross-platform support for Android, iOS, and macOS with a unified Dart API.
  • Bundled OpenVPN engines and support for modern requirements like 16 KB page sizes on Android.
  • Streams for stage changes, traffic updates, and engine logs.

Weaknesses

  • Requires native configuration and setup for Network Extensions on iOS and macOS.
  • Android requires specific packaging rules and foreground service permissions.

Setup

Kind
Plugin (native code)
Effort
High
Code generation
No
Direct dependencies
0

Requires native configuration in Android Gradle, creating a Network Extension target and adding App Groups in Xcode for iOS and macOS, plus CocoaPods or SPM integration for OpenVPNAdapter.

import 'package:openvpn_flutter/openvpn_flutter.dart';

late final OpenVPN openvpn;

@override
void initState() {
  super.initState();
  openvpn = OpenVPN(
    onVpnStageChanged: (stage, raw) => setState(() => this.stage = stage),
    onVpnStatusChanged: (status) => setState(() => this.status = status),
  );
  openvpn.initialize(
    groupIdentifier: 'group.com.example.vpn',
    providerBundleIdentifier: 'com.example.app.VPNExtension',
    localizedDescription: 'Example VPN',
  );
}

Alternatives

Packages that do the same job and could replace openvpn_flutter.

  • http2

    An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.

  • nm

    Client for interacting with Linux NetworkManager via D-Bus

  • ftpconnect

    Interact with FTP, FTPS, FTPES, and SFTP servers to upload, download, and manage files.