startScanWithOptions method

Future<bool> startScanWithOptions(
  1. BluetoothScanOptions options, {
  2. bool autoRequestPermission = true,
})

Starts scanning with granular native Bluetooth scanning options.

Implementation

Future<bool> startScanWithOptions(
  BluetoothScanOptions options, {
  bool autoRequestPermission = true,
}) async {
  return _mutex.protect(() async {
    if (autoRequestPermission) {
      final granted = await NexoraSdkPlatform.instance
          .requestBluetoothPermission();
      if (!granted) return false;
    }
    final result = await NexoraSdkPlatform.instance
        .startBluetoothScanWithOptions(options);
    if (result) _isScanning = true;
    return result;
  });
}