A new Flutter plugin that uses OpenVpn

Overview

flutter_openvpn

A new Flutter plugin that uses OpenVpn.

Installation

  1. Depend on it Add this to your package's pubspec.yaml file:
dependencies:
  flutter_openvpn: ^0.2.0
  1. 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.

  1. Import it Now in your Dart code, you can use:
import 'package:flutter_openvpn/flutter_openvpn.dart';

Supported Platforms

  • 22 >= Android
  • 9.0 >= iOS

Build project first

  • After adding package to pubspec.yaml, Run build command
flutter build apk --debug //for android
flutter build ios --no-codesign //for ios

Ignore any build errors.

Android integration

  • Change minimum sdk to 22 :
  1. Open Your project in Android Studio.
  2. Open your MainActivity.java(or .kt for kotlin) file (Located in android/app/src/main/YOUR_PACKAGE_NAME/MainActivity)
  3. Override onActivityResult in your activity and add this code to function body
if (requestCode == 1) {
    if (resultCode == RESULT_OK) {
        FlutterOpenvpnPlugin.setPermission(true);
    } else {
        FlutterOpenvpnPlugin.setPermission(false);
    }
}
  1. Finally import FlutterOpenVpn with this import statement
import com.topfreelancerdeveloper.flutter_openvpn.FlutterOpenvpnPlugin;

iOS integration

  • Add VPN Entitlements
  1. Open ios/Runner.xcworkspace in xcode
  2. In Runner target -> Signing & Capabalities -> Click on "+ Capabality" button
  3. Add both "Network Extension" and "App Groups" capabalities
  4. Select ONLY "Packet Tunnel" form newly created Network Extension menu.
  5. Make sure your Bundle identifier is checked in App Groups.
  6. View This Screenshot for visual Guide
  • Add Network Extension Target
  1. Below Runner target click on "+" button to add new target
  2. Search for "Network Extension" in newly opened page and click on next
  3. Give it a name(Without space) and make sure to select Swift as Language and Packet Tunnel as Provider Type.
  4. Click on finish and agree to any message relating to "Activating Extension"
  5. Repeat "Add VPN Entitlements" for newly created target as well
  6. View This Screenshot for visual Guide
  • Change minimum platform target to iOS 9.0 :
  1. In Runner target -> Deployment Info -> change Target to iOS 9.0
  2. Repeat step 2 for your VPN Extension Target as well
  1. Open ios/PodFile
  2. Change your PodFile according to this:
	.
	.
	.
target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

//Add this part
target 'YOUR_TARGET_EXTENSION_NAME' do
  use_frameworks!
  use_modular_headers!
  pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.7.0'
end
	.
	.
	.
  1. Run 'pod install' command in /ios directory
  • Disable Bitcode
  1. In Vpn Extension Target -> Build Settings
  2. Search for "Bitcode" and set it to NO
  • Add code to PacketTunnelProvider
  1. Open VPNExtension folder/PacketTunnelProvider.swift in xcode.
  2. Replace all code with this and save

Dart/Flutter integration

  • Initilize plugin
FlutterOpenvpn.init(
          localizedDescription: "ExampleVPN", //this is required only on iOS
          providerBundleIdentifier: "com.topfreelancerdeveloper.flutterOpenvpnExample.RunnerExtension",//this is required only on iOS
	  //localizedDescription is the name of your VPN profile
	  //providerBundleIdentifier is the bundle id of your vpn extension
)
/* returns {"currentStatus" : "VPN_CURRENT_STATUS",
	   "expireAt" : "VPN_EXPIRE_DATE_STRING_IN_FORMAT(yyyy-MM-dd HH:mm:ss)",} if successful
 returns null if failed
*/

View this for more info on VPN status Strings

  • Add VPN Profile and connect
FlutterOpenvpn.lunchVpn(
          ovpnFileContent, //content of your .ovpn file
          (isProfileLoaded) => print('isProfileLoaded : $isProfileLoaded'),
          (newVpnStatus) => print('vpnActivated : $newVpnStatus'),
          expireAt: DateTime.now().add(Duration(seconds: 30)),
	  //(Optional) VPN automatically disconnects in next 30 seconds
         )

Publishing to Play Store and App Store

Android

. Recently I discovered an issue with plugin not working with appbundles . If you want to publish to play store use apks . view this issue to stay updated on the matter

iOS

. View Apple Guidelines Relating to VPN . This plugin DOES use Encryption BUT, It uses Exempt Encryptions

You might also like...
Flutter plugin to display VGS card info using TextView or View

VGS Card Info Flutter plugin to display VGS Card info using TextView or View Installation Add the dependency in your pubspec.yaml vgscardinfo: git

Resource monitor - A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

resource_monitor A flutter plugin for Android and IOS to monitor CPU and RAM usage of device. TODO Implement Android Side of this plugin. Add listener

A Flutter plugin to wrap HyperPay SDK for iOS and Android.
A Flutter plugin to wrap HyperPay SDK for iOS and Android.

HyperPay Flutter Plugin This plugin is a wrapper around HyperPay iOS and Android SDK, it's still in alpha release, and supports limited set of functio

VisionCamera Frame Processor Plugin that uses Tensorflow to recognize hand poses

vision-camera-handpose VisionCamera Frame Processor Plugin that uses Tensorflow to recognize hand poses Installation npm install vision-camera-handpos

Xcode-streamdeck-plugin - A Stream Deck plugin for Xcode
Xcode-streamdeck-plugin - A Stream Deck plugin for Xcode

Stream Deck Xcode Plugin This repository contains a Stream Deck plugin to add so

Plugin-spell-timer - Spell Timer Plugin for Outlander

Spell Timer Plugin for Outlander This plugin provides variables for spells from

Cordova-plugin-saveimage - This plugin helps you save images

cordova-plugin-saveimage This plugin helps you save images on iOS/Android Instal

Swift-lint-plugin - A SwiftPM plugin that adds a linting command

SwiftLintPlugin This is a SwiftPM plugin that adds a lint command. SwiftPM plugi

Discover new programming concepts and more new SwiftUI 2 features in this section

Africa-Zoo One thing is sure, we will discover new programming concepts and more new SwiftUI 2 features in this section. TOPICS ARE COVERED: JSON with

Flutter & flutter_boost开发iOS混合开发项目问题记录;iOS远程依赖Flutter Module组件代码;
Flutter & flutter_boost开发iOS混合开发项目问题记录;iOS远程依赖Flutter Module组件代码;

[TOC] 这个仓库主要有2部分,整理了如何在iOS项目导入FlutterModule组件代码,以及整理开发过程中遇到的一些问题和对应的解决方案。 在iOS项目依赖FlutterModule组件代码 依赖Flutter组件代码的分为本地依赖、远程依赖2种。下面介绍的前3种是本地依赖,同时也是官方推荐

Corona Virus Tracker & Advices App with Flutter
Corona Virus Tracker & Advices App with Flutter

Corona Virus Tracker & Advices App with Flutter Try the web app dev preview https://alfian-flutter-coronatracker.firebaseapp.com/ Features Current sta

Flutter package for detecting NSFW images and videos using native implementation

Flutter NSFW 1- Download, tflite modle and put it in assets folder 2 - Add the path of the tfliet to pubspec.yaml 3 - Read the file using path_provide

Projeto utilizando Flutter para desenvolver uma aplicação com o objetivo de gerenciar uma lista de livros, como se fosse uma biblioteca, sendo possível adicionar, editar e excluir livros.

todo_list_flutter A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you st

Mi Card App for Android & IOS in Flutter
Mi Card App for Android & IOS in Flutter

Mi Card Our Goal Now that you've seen how to create a Flutter app entirely from scratch, we're going to go further and learn more about how to design

Magic 8Ball App for Android & IOS in Flutter
Magic 8Ball App for Android & IOS in Flutter

Magic 8 Ball 🎱 Our Goal The objective of this challenge is to solidify what you've learn't in the Dicee tutorial. This app will guide you through the

Dicee App for Android & IOS in Flutter
Dicee App for Android & IOS in Flutter

Dicee 🎲 Our Goal The objective of this tutorial is to introduce you to the core programming concepts that will form the foundation of most of the app

Flutter Piano Audio Detection implemented with Tensorflow Lite Model (Google Magenta)
Flutter Piano Audio Detection implemented with Tensorflow Lite Model (Google Magenta)

FlutterPianoAudioDetection Plugin Flutter Piano Audio Detection implemented with Tensorflow Lite Model (Google Magenta) Android Implementation iOS/iPa

 Flutter Apple Product Store App UI Home Page With Getx
Flutter Apple Product Store App UI Home Page With Getx

Flutter Apple Product Store App UI Home Page With Getx A new Flutter UI Project on my Youtube Channel . About The Project Create a beautiful Flutter U

Owner
Vladislav Len
Backend developer
Vladislav Len
Klab Academy, example of calling APIs in flutter

klab A new Flutter application. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Hubert IT 0 Dec 2, 2021
Plugin and runtime library for using protobuf with Swift

Swift Protobuf Welcome to Swift Protobuf! Apple's Swift programming language is a perfect complement to Google's Protocol Buffer ("protobuf") serializ

Apple 4.1k Jan 6, 2023
Plugin for authorization with Facebook for Godot Game Engine (iOS)

GodotFacebookAuth Plugin for authorization with Facebook for Godot Game Engine (iOS) Supports iOS deployment target >= 10.0 Supports Godot version >=

Oleksandr Kurtsev 6 Sep 20, 2022
A new, clean and lean network interface reachability library written in Swift.

Reachability A new, clean and lean network interface reachability library written in Swift. Remarks Network reachability changes can be monitored usin

Alecrim 7 Aug 8, 2022
Music Room: a mobile app that offers a new way of experiencing music

?? Music Room - 42 School Project ?? ???? Music Room is a mobile app that offers

Marie-Lise Picard 3 Feb 18, 2022
A new Flutter plugin that uses OpenVpn

flutter_openvpn A new Flutter plugin that uses OpenVpn. Installation Depend on it Add this to your package's pubspec.yaml file: dependencies: flutte

Vladislav Len 4 Dec 26, 2022
Passepartout is a non-official, user-friendly OpenVPN® client for iOS and macOS.

Passepartout Passepartout is a non-official, user-friendly OpenVPN® client for iOS and macOS. Overview All profiles in one place Passepartout lets you

Passepartout 523 Dec 27, 2022
Realtime yoga pose detection and classification plugin for Flutter using MLKit

ML Kit Pose Detection Plugin Flutter plugin for realtime pose detection using MLKit's Blazepose. License Copyright (c) 2021 Souvik Biswas, Bharat Bira

Souvik Biswas 8 May 5, 2022
A Flutter plugin (platform channel with Swift) to get the current app name and also bring our app to the front.

window_to_front A new flutter plugin project. Getting Started This project is a starting point for a Flutter plug-in package, a specialized package th

Minas Giannekas 1 Nov 13, 2021
A apple search ads attribution plugin for flutter

A apple search ads attribution plugin for flutter

liam 0 Oct 27, 2021