Skip to content
pubscout

vpn_connection_detector

2.1.0, released 5 months ago by an unverified publisher

Detect system and third-party VPN connections with native iOS and Android support.

$ flutter pub add vpn_connection_detector
Source repository

What it does

Detects active VPN connections using native iOS and Android APIs, including both system-configured VPN profiles and third-party applications like NordVPN or ExpressVPN. It provides one-time checks as well as real-time status streams and protocol details.

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

Use it when

  • You need to detect if a user is connected to a VPN on iOS, Android, or desktop platforms.
  • You require real-time updates when a user connects or disconnects from a VPN.
  • You need detailed information such as the active network interface and VPN protocol.

Skip it when

  • You need to run VPN detection inside a web browser.
  • You require 100% precision on desktop operating systems where fallback heuristics are used.

Strengths

  • Detects both system-configured VPNs and third-party apps with high accuracy on mobile.
  • Provides a real-time status stream alongside one-time check methods.
  • App Store safe without requiring restricted entitlements.

Weaknesses

  • Desktop platforms rely on fallback interface name matching with lower accuracy.
  • Not supported on the web platform.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
2

Add the ACCESS_NETWORK_STATE permission to your AndroidManifest.xml for Android support. No additional setup is required for iOS.

import 'package:vpn_connection_detector/vpn_connection_detector.dart';

void checkVpn() async {
  bool isVpnConnected = await VpnConnectionDetector.isVpnActive();
  if (isVpnConnected) {
    print('VPN is connected');
  } else {
    print('VPN is not connected');
  }
}

Alternatives

Packages that do the same job and could replace vpn_connection_detector.

Works with

Packages commonly used together with vpn_connection_detector: ones it builds on, ones built on it, and its own family.