stopScan method

Future<void> stopScan({
  1. bool stopBle = true,
  2. bool stopUsb = true,
})

Implementation

Future<void> stopScan({
  bool stopBle = true,
  bool stopUsb = true,
}) async {
  try {
    if (stopBle) {
      await subscription?.cancel();
      await FlutterBluePlus.stopScan();
    }
    if (stopUsb) {
      await _usbSubscription?.cancel();
    }
    if (refresher != null && stopBle && stopUsb) {
      await refresher?.cancel();
    }
  } catch (e) {
    log('Failed to stop scanning for devices $e');
  }
}