scanResultsList method
void
scanResultsList(
- dynamic callback(
- bool isSuccess,
- String msg
)
)
Implementation
void scanResultsList(Function(bool isSuccess, String msg) callback) {
wifiSetting(callback: (isSuccess) {
if (isSuccess) {
UnitsForNetwork.getHttpForDevice(scannerListApi, parameters: {},
onSuccess: (res) {
if (Platform.isIOS) {
//iOS需要手动停止监听网络连接情况
MethodChannel methodChannel = const MethodChannel(messageChannelID);
Map map = {
'wifiName': '',
'wifiPassword': '',
'operation': 'stopReaching'
};
methodChannel.invokeListMethod("flutterCallNativeWifi", map);
}
Map mA = res["_embedded"];
List<Map<String, dynamic>> listTemp = [];
mA.forEach((key, value) {
listTemp.add(value);
});
listTemp.sort(((a, b) {
num aNum = a["recordingTime"];
num bNum = b["recordingTime"];
return aNum.compareTo(bNum);
}));
Map dic = listTemp.first["_links"]["enclosure"];
String path = dic["href"];
locPath = path;
downloadScannerFile();
}, onError: (error) {});
}
});
}