Commit 211a0d84 authored by hywang's avatar hywang

1.修复扫描蓝牙设备异常

parent 446eab12
......@@ -44,13 +44,13 @@ class BleService extends GetxService {
});
_scanResultsSubscription = FlutterBluePlus.scanResults.listen((results) {
List<ScanResult> tempList = List.from(results);
for (var element in tempList) {
if (!EmptyUtils.isStrNotEmpty(element.device.platformName)) {
tempList.remove(element);
}
}
scanResults.value = tempList;
// List<ScanResult> tempList = List.from(results);
// for (var element in tempList) {
// if (!EmptyUtils.isStrNotEmpty(element.device.platformName)) {
// tempList.remove(element);
// }
// }
scanResults.value = results;
}, onError: (e) {
DialogUtils.showToast('扫描错误');
});
......
......@@ -32,8 +32,8 @@ class SettingPage extends StatelessWidget {
itemCount: BleService.to.scanResults.length,
itemBuilder: (BuildContext context, int index) {
return ListTile(
title: Text(BleService.to.scanResults[index].device.advName),
subtitle: Text(BleService.to.scanResults[index].device.platformName),
title: Text(BleService.to.scanResults[index].device.platformName),
subtitle: Text(BleService.to.scanResults[index].device.remoteId.toString()),
onTap: ()=>{
logic.connectBle(context,index),
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment