androidflutterandroid-wifiwifimanager

Is there a Flutter library that can scan for WIFI networks and connect/disconnect to/from these networks, that works for Android API level 28-30


I am working on a Flutter app that needs to scan for WIFI networks and be able to connect and disconnect to/from these.

I have tried to use wifi_configuration which works with Android 9(API level 28) but not above this.

I also tried using the following libraries, wifi_iot, wifi, which does not seem to support Android 10 and 11.

Do you know if there exist any library that support these actions in Android 9, 10 and 11?

I have also tried to find a Java or Kotlin library that supports these features for the different Android version. I can create a method-channel to communicate to these from my Flutter app, but I have not be able to find any libraries that have support for these different Android version. Are there any libraries/packages in Java/Kotlin that can accomplish this?


Solution

  • I'm using wifi_iot. scan, connect & disconnects is working on android 11.

    use WiFiForIoTPlugin.loadWifiList() for scanning available networks

    // scanning
    final wifis = await WiFiForIoTPlugin.loadWifiList();
    log("${wifis.map((e) => e.ssid).toList()}");
    
    // connecting
    final ssid = "test network";
    final res = await WiFiForIoTPlugin.connect(
            ssid,
            password: "12345678",
            security: NetworkSecurity.WPA,
            withInternet: false,
          );
    if (res)
      print("connected")