check_vpn_connection 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 60

check_vpn_connection #

License: MIT Pub

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

Note that this plugin is in the early stages of development and has been poorly tested. You can use the plugin at your own risk.

How to use #

You can get a VPN connection status, which is either true (vpn connected) or false (no vpn connection)


if (await CheckVpnConnection.isVpnActive()) {
  //do some action if VPN connection status is true
}

Also see our Example.

Issues #

Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute #

To contribute, follow the following easy steps

Step 1
  • Fork this repo!
Step 2
  • Make your own updates
Step 3
  • Create a new pull request

0.0.1 #

  • Initial version

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();
                }),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  check_vpn_connection: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:check_vpn_connection/check_vpn_connection.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
24
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [check_vpn_connection] that is in a package requiring null.

Package not compatible with runtime flutter-web on web

Because of the import of dart:io via the import chain package:check_vpn_connection/check_vpn_connection.dartdart:io

Health suggestions

Format lib/check_vpn_connection.dart.

Run flutter format to format lib/check_vpn_connection.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test