bleUnlocks method
dynamic
bleUnlocks({})
开启附近设备
Implementation
bleUnlocks(
{bool isVibrate = false, //开门成功是否震动
Function(Map map)? success,
Function(Map map)? foundMultipleDevices,
Function(PlatformException e)? fail}) async {
try {
String json = await methodChannel.invokeMethod("bleUnlock");
Map<String, dynamic> map = convert.json.decode(json);
switch (map['type']) {
case 'DEVICES':
if (foundMultipleDevices != null) foundMultipleDevices(map);
break;
case 'UNLOCK':
if (isVibrate) Vibrate().start();
if (success != null) success(map);
break;
}
} catch (e) {
if (fail != null) fail(e as PlatformException);
}
}