readNetworkList method

Future<List<WifiNetwork>> readNetworkList()

Implementation

Future<List<WifiNetwork>> readNetworkList() async {
  final bleService = await getBleService();
  final networkListCharacteristic = bleService.characteristics.firstWhere(
    (char) => char.uuid.str == ViamBluetoothUUIDs.availableWiFiNetworksUUID,
    orElse: () => throw Exception('networkListCharacteristic not found'),
  );

  final networkListBytes = await networkListCharacteristic.read();
  return ViamBluetoothProvisioning.convertNetworkListBytes(Uint8List.fromList(networkListBytes));
}