stopScanning method

Future<void> stopScanning()

Stop scanning for BLE devices.

Stops the scanning process and cancels the scan subscription.

Implementation

Future<void> stopScanning() async {
  if (state is! BleDeviceScanning) return;

  emit(BleDeviceScanning(
      discoveredDevices: (state as BleDeviceScanning).discoveredDevices,
      scanIsInProgress: false));
  await _scanSubs?.cancel();
  _scanSubs = null;
  _scanTimer?.cancel();
  _scanTimer = null;
}