better_wifi_manager 0.0.3
better_wifi_manager: ^0.0.3 copied to clipboard

A simple Wifi manager for Flutter.

better_wifi_manager #

A simple Wifi manager for Flutter.

Install Started #

  1. Add this to your pubspec.yaml file:
dependencies:
  better_wifi_manager: ^0.0.3
  1. Install it
$ flutter packages get
  1. Config permission <br/>

iOS

TARGETS -> Signing $ Capabilities -> +Capability -> Access WiFi Information. <br/> Info.plist -> add Privacy - Location When In Use Usage Description.

Android

AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Normal usage #

  1. ensure wifi is opened.

  2. request location permission.

  3. get wifi info or scan wifi list.

  final currentSSID = await wifiManager.getWifiInfo();

  scanResultSubscription = wifiManager.scanResultStream.listen((event) {
    scanResultSubscription?.cancel();
    final scanResult = event["scanResult"].toString();
    if (scanResult.isNotEmpty) {
      List<WifiScanResult> wifiScanResultList = jsonDecode(scanResult)
          .map((e) {
            return WifiScanResult().wifiScanResultEntityFromJson(e);
          })
          .cast<WifiScanResult>()
          .toList();

      setState(() {
        this.wifiScanResult = wifiScanResultList;
      });
    }
  });
  await wifiManager.scanWifi();

Feature #

  • [x] determine WiFi enable.
  • [x] get WiFi info.
  • [x] scan wifi. (only Android)
0
likes
70
pub points
16%
popularity

Publisher

Unknown

A simple Wifi manager for Flutter.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on better_wifi_manager