Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to find wifi #11

Open
KOYAMANI opened this issue Apr 15, 2021 · 2 comments
Open

unable to find wifi #11

KOYAMANI opened this issue Apr 15, 2021 · 2 comments

Comments

@KOYAMANI
Copy link

with this example, it is searching wifi forever and never be done. Does anyone have solution ?

@naits
Copy link

naits commented Aug 26, 2021

I have the same issue.. Getting the following message:
error: The argument type 'List' can't be assigned to the parameter type 'List<Map<String, dynamic>>'. (argument_type_not_assignable at lib/screens/wifi_screen/wifi_bloc.dart:51)

I'm able to get the number of wifiAP's discovered, and list out the WifiAP ssid, but not sure on how to get the listWifi to fit with the type 'List<Map<String, dynamic>>'.

I'm using the provisioning sample code from the ESP IDF, and it works as expected with the "original" provisioning apps from espressif downloaded from the app-store.

@naits
Copy link

naits commented Aug 29, 2021

Not sure this is helpful to you @KOYAMANI , but I managed to make a mess that seems to make the WifiList finally work in my own app.. I just made a new list that, and add all the wifiAP details to the new list.

Stream<WifiState> _mapLoadToState() async* {
    yield WifiStateConnecting();
    try {
      prov = await bleService.startProvisioning();
    } catch (e) {
      log.e('Error connecting to device $e');
      yield WifiStateError('Error connecting to device');
    }
    yield WifiStateScanning();


    try {
      var listWifi = await prov.startScanWiFi();
      final List<Map<String, dynamic>> dyncamicListWifi = [];
      listWifi.forEach((element) {
        dyncamicListWifi.add({
          'ssid': element.ssid,
          'rssi': element.rssi,
          'active': element.active,
          'private': element.private
        });
      });
      //yield WifiStateLoaded(wifiList: listWifi ?? []);
      yield WifiStateLoaded(wifiList: dyncamicListWifi ?? []);

      // log.v('Wifi $listWifi');
      log.v('Wifi $dyncamicListWifi');
    } catch (e) {
      log.e('Error scan WiFi network $e');
      yield WifiStateError('Error scan WiFi network');
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants