flutter_openvpn 0.2.0 copy "flutter_openvpn: ^0.2.0" to clipboard
flutter_openvpn: ^0.2.0 copied to clipboard

Flutter OpenVPN uses OpenVpn Protocol to connect with ovpn file configurations.

example/lib/main.dart

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

import 'package:flutter_openvpn/flutter_openvpn.dart';
import 'package:flutter_openvpn_example/newPage.dart';

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

class MyApp extends StatefulWidget {
  static Future<void> initPlatformState() async {
    await FlutterOpenvpn.lunchVpn(
      "SAMPLE_OVPN_FILE",
      (isProfileLoaded) {
        print('isProfileLoaded : $isProfileLoaded');
      },
      (vpnActivated) {
        print('vpnActivated : $vpnActivated');
      },
      user: 'user',
      pass: 'pass',
      onConnectionStatusChanged:
          (duration, lastPacketRecieve, byteIn, byteOut) => print(byteIn),
      expireAt: DateTime.now().add(
        Duration(
          seconds: 180,
        ),
      ),
    );
  }

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      onGenerateRoute: (settings) => MaterialPageRoute(
          builder: (context) => NewPAge(
              settings.name.contains(NewPAge.subPath)
                  ? settings.name.split(NewPAge.subPath)[1]
                  : '0',
              settings.name.split(NewPAge.subPath)[1].compareTo('2') < 0),
          settings: settings),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: NewPAge('0', true),
      ),
    );
  }
}
45
likes
40
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter OpenVPN uses OpenVpn Protocol to connect with ovpn file configurations.

Repository (GitLab)
View/report issues

License

BSD-2-Clause (license)

Dependencies

flutter, intl, shared_preferences

More

Packages that depend on flutter_openvpn