wifi_configuration 1.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 85

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';
  
  
  
    WifiConnectionStatus connectionStatus = 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 (connectionStatus) {
              case WifiConnectionStatus.connected:
                print("connected");
                break;
        
              case WifiConnectionStatus.alreadyConnected:
                print("alreadyConnected");
                break;
        
              case WifiConnectionStatus.notConnected:
                print("notConnected");
                break;
        
              case WifiConnectionStatus.platformNotSupported:
                print("platformNotSupported");
                break;
        
              case WifiConnectionStatus.profileAlreadyInstalled:
                print("profileAlreadyInstalled");
                break;
        
              case WifiConnectionStatus.locationNotAllowed:
                print("locationNotAllowed");
                break;
            }
  
  
        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.2.1 #

Added location turn on feature for android also added connection status as enum that will help to cover all available response cases from plugin. Added plugin to github.

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.2.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:wifi_configuration/wifi_configuration.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
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]
85
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/wifi_configuration.dart. (-0.50 points)

Analysis of lib/wifi_configuration.dart reported 1 hint:

line 24 col 10: This function has a return type of 'Future

Format lib/generated/i18n.dart.

Run flutter format to format lib/generated/i18n.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 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test