Last updated:
0 purchases
better wifi manager
better_wifi_manager #
A simple Wifi manager for Flutter.
Install Started #
Add this to your pubspec.yaml file:
dependencies:
better_wifi_manager: ^0.0.5
copied to clipboard
Install it
$ flutter packages get
copied to clipboard
Config permission
iOS
TARGETS -> Signing $ Capabilities -> +Capability -> Access WiFi Information.
Info.plist -> add Privacy - NSLocationWhenInUseUsageDescription.
Info.plist -> add Privacy - NSLocationTemporaryUsageDescriptionDictionary.
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" />
copied to clipboard
Normal usage #
ensure wifi is opened.
request location permission.
2.1 request accuracy location permission for iOS.
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();
copied to clipboard
Feature #
✅ determine WiFi enable.
✅ get WiFi info.
✅ scan wifi. (only Android)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.