wifi_configuration 1.0.14

wifi_configuration #

A new Flutter plugin.

Getting Started #

This plugin allows Flutter apps to get available wifi ssid list, user can connect to wifi with ssid and password. This plugin works Android. iOS will be released later.

Sample usage to check current status:

Note :- This plugin requires the location permission to auto enable the wifi if android version is above 9.0.

For Android : - Add below Permissions to your manifist.xml file -

    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-feature android:name="android.hardware.wifi" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  import 'package:wifi_configuration/wifi_configuration.dart';
  
  
  
    String connectionState = await WifiConfiguration.connectToWifi("ssidName", "passName", "your android packagename");
    //This will return state of a connection
    //Package name is required to redirect user to application permission settings page to let user allow location permission
    //in case connecting with wifi
  
  
        switch (connectionState) {
          case "connected":
            print("connected");
            break;
            //in case of wifi successfully connected
  
          case "alreadyConnected":
            print("alreadyConnected");
            break;
            //in case wifi already connected
            //Only returned in ios
  
          case "notConnected":
            print("notConnected");
            break;
            //in case when wifi not availabel or not able to connect to specific wifi
            //when not connected status returned in android user will be directed to wifi settings of device to select the exact wifi to connect.
  
          case "profileAlreadyInstalled":
            print("profileAlreadyInstalled");
            break;
           //in case of wifi configuration profile is installed already
           //Only returned in ios
  
        case "locationNotAllowed":
          print("locationNotAllowed");
          break;
          //in case location permission rejected
          //Only returned in android
        }
  
  
        var listAvailableWifi = await WifiConfiguration.getWifiList();
          //If wifi is available then device will get connected
          //In case of ios you will not get list of connected wifi an empty list will be available
          //As Apple does not allow to scan the available hotspot list
          //If you try to access with private api's then apple will reject the app
  
  
        bool isConnected = await WifiConfiguration.isConnectedToWifi("ssidName");
        //to get status if device connected to some wifi
        
        String isConnected = await WifiConfiguration.connectedToWifi();
                //to get current connected wifi name
        

If user has not aloowed the location permission for this app then it will ask everytime app try to connect to wifi for the location permission.

When you use connection on iOS (iOS 11 and above only)

  1. 'build Phass' -> 'Link Binay With Libraries' add 'NetworkExtension.framework'

  2. in 'Capabilities' open 'Hotspot Configuration'

  3. If you device is iOS12, in 'Capabilities' open 'Access WiFi Information'

If you want to use Wifi.list on iOS,

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

1.0.14 #

Added Android location permission for connected wifi name(Mandatory for Android 9.0 and above).

example/README.md

wifi_configuration_example #

Demonstrates how to use the wifi_configuration plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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


dependencies:
  wifi_configuration: ^1.0.14

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:wifi_configuration/wifi_configuration.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
72
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
82
Learn more about scoring.

We analyzed this package on Sep 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.dart.

Format lib/wifi_configuration.dart.

Run flutter format to format lib/wifi_configuration.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test