Line data Source code
1 : import 'package:flutter/foundation.dart';
2 : import 'package:flutter/services.dart';
3 :
4 : import 'vpn_detector_platform_interface.dart';
5 :
6 : /// An implementation of [VpnDetectorPlatform] that uses method channels.
7 : class MethodChannelVpnDetector extends VpnDetectorPlatform {
8 : /// The method channel used to interact with the native platform.
9 : @visibleForTesting
10 : final methodChannel = const MethodChannel('vpn_detector');
11 :
12 1 : @override
13 : Future<bool> isVpnActive() async {
14 2 : final isActive = await methodChannel.invokeMethod<bool>('isVpnActive');
15 : return isActive ?? false;
16 : }
17 : }
|