check_vpn_connection 0.0.2 copy "check_vpn_connection: ^0.0.2" to clipboard
check_vpn_connection: ^0.0.2 copied to clipboard

A simple and lightweight Flutter package that lets you define VPN connection status on your devices.

example/lib/main.dart

import 'package:check_vpn_connection/check_vpn_connection.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Check VPN connection"),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'VPN is active:',
            ),
            FutureBuilder(
                future: CheckVpnConnection.isVpnActive(),
                builder: (context, AsyncSnapshot<bool> snapshot) {
                  if (snapshot.hasData) {
                    return Text(
                      snapshot.data.toString(),
                      style: Theme.of(context).textTheme.headline4,
                    );
                  } else
                    return CircularProgressIndicator();
                }),
          ],
        ),
      ),
    );
  }
}
copied to clipboard
38
likes
150
points
4.03k
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.18 - 2025.04.02

A simple and lightweight Flutter package that lets you define VPN connection status on your devices.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on check_vpn_connection