vpn_detector
1.3.1, released 6 months ago by aelahmar.com
Detects active VPN connections on Android and iOS with real-time updates.
What it does
Provides a method to check if a VPN is active and a stream that emits status changes. The API is testable via dependency injection and works without hidden singletons.
AI-written summary of version 1.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to block or warn users when they are on a VPN for security or compliance reasons
- You want to react in‑app to VPN status changes, e.g., adjust network behavior
- You need a lightweight, platform‑specific VPN check without pulling in a full networking stack
Skip it when
- Your app also targets web or desktop platforms
- You require detailed network diagnostics beyond VPN detection
- You prefer a pure‑Dart solution without native code
Strengths
- Reliable detection on both Android and iOS
- Real‑time status updates via a stream
- Testable design with injectable dependencies
- Zero static singleton usage
Weaknesses
- Only supports mobile platforms (no web/desktop)
- Requires native setup (SwiftPM for iOS, Android SDK changes)
- Limited to VPN detection only
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 3
Add vpn_detector to pubspec, run flutter pub get, ensure iOS SwiftPM integration (Swift 5, iOS 13+) and Android compileSdk 35/minSdk 21. No extra permissions required.
import 'package:vpn_detector/vpn_detector.dart';
void main() async {
final status = await VpnDetector().isVpnActive();
print(status == VpnStatus.active ? 'VPN is active' : 'VPN is not active');
}Alternatives
Packages that do the same job and could replace vpn_detector.
- in_app_update
Triggers official Google Play In-App Updates on Android devices.
81Compare - location
Flutter plugin to get real-time device location across platforms.
94Compare - pedometer
A Pedometer and Step Detection package for Android and iOS.
83Compare - vpn_connection_detector
Detect system and third-party VPN connections with native iOS and Android support.
65Compare
Works with
Packages commonly used together with vpn_detector: ones it builds on, ones built on it, and its own family.