cancelBleDeviceConnectState method

dynamic cancelBleDeviceConnectState({
  1. StreamSubscription? subscription,
})

取消当前连接设备的蓝牙连接状态监听 当参数为空的时候清空所有监听

Implementation

cancelBleDeviceConnectState({StreamSubscription? subscription}) async {
  if (subscription == null) {
    for (var value in _bleConnectStateList) {
      value.cancel();
    }
    _bleConnectStateList.clear();
  } else {
    subscription.cancel();
    _bleConnectStateList.remove(subscription);
  }
}