stopDiscovery method

Future<bool> stopDiscovery()

Stops device discovery

Implementation

Future<bool> stopDiscovery() async {
  if (!isScanning) {
    return false;
  }

  _updateScanState(BluetoothScanState.stopping);

  try {
    final result = await _channel.invokeMethod('stopDiscovery');
    _updateScanState(BluetoothScanState.idle);
    return result;
  } catch (e) {
    _updateScanState(BluetoothScanState.idle);
    return false;
  }
}