1.搜索列表优化(FlutterBlue.instance.scan搜索重复、搜索结果处理、更新之前保存缓存数据)
2.保存连接过的设备
3.十进制转十六进制
4.写入十六进制数据
json_scan.dart 实体类(主要是使用flutter_blue的device保存到本地缓存会有问题)
class ScanResultArr {
String rssi;
DeviceItem device;
ScanResultArr({this.rssi, this.device});
ScanResultArr.fromJson(Map<String, dynamic> json) {
rssi = json['rssi'];
device = json['device'] != null
? new DeviceItem.fromJson(json['device'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['rssi'] = this.rssi;
if (this.device != null) {
data['device'] = this.device.toJson();
}
return data;
}
}
class DeviceItem