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();
                }),
          ],
        ),
      ),
    );
  }
}
38
likes
150
pub points
91%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on check_vpn_connection