# Bluetooth device picker

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_flutter/bluetooth-device-picker

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## BluetoothDevicePicker [#bluetoothdevicepicker]

```dart
class BluetoothDevicePicker extends StatelessWidget
```

Lists nearby supported devices and connects to the selected device.

### Constructors [#constructors]

#### BluetoothDevicePicker.new [#bluetoothdevicepickernew]

```dart
BluetoothDevicePicker({
  ValueChanged<BluetoothNearbyDevice>? onSelect,
  VoidCallback? onDismiss,
  String title = 'Choose a device',
  String dismissLabel = 'Not now',
  String? Function(BluetoothNearbyDevice)? getDeviceImage,
  String Function(BluetoothNearbyDevice)? labelForDevice,
  BluetoothDevicePickerRowBuilder? renderRow,
  Key? key,
})
```

Creates the content for a modal device picker.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `onSelect` | `ValueChanged?` | named |  |
| `onDismiss` | `VoidCallback?` | named |  |
| `title` | `String` | named | `'Choose a device'` |
| `dismissLabel` | `String` | named | `'Not now'` |
| `getDeviceImage` | `String? Function(BluetoothNearbyDevice)?` | named |  |
| `labelForDevice` | `String Function(BluetoothNearbyDevice)?` | named |  |
| `renderRow` | `BluetoothDevicePickerRowBuilder?` | named |  |
| `key` | `Key?` | named |  |

### Properties [#properties]

#### BluetoothDevicePicker.onSelect [#bluetoothdevicepickeronselect]

```dart
final ValueChanged? onSelect
```

Called when a selected device starts connecting.

#### BluetoothDevicePicker.onDismiss [#bluetoothdevicepickerondismiss]

```dart
final VoidCallback? onDismiss
```

Called when the picker is dismissed without selecting a device.

#### BluetoothDevicePicker.title [#bluetoothdevicepickertitle]

```dart
final String title
```

The picker heading.

#### BluetoothDevicePicker.dismissLabel [#bluetoothdevicepickerdismisslabel]

```dart
final String dismissLabel
```

The dismiss button label.

#### BluetoothDevicePicker.getDeviceImage [#bluetoothdevicepickergetdeviceimage]

```dart
final String? Function(BluetoothNearbyDevice)? getDeviceImage
```

Returns an optional device image URL.

#### BluetoothDevicePicker.labelForDevice [#bluetoothdevicepickerlabelfordevice]

```dart
final String Function(BluetoothNearbyDevice)? labelForDevice
```

Returns the device label; defaults to its advertised name or key.

#### BluetoothDevicePicker.renderRow [#bluetoothdevicepickerrenderrow]

```dart
final BluetoothDevicePickerRowBuilder? renderRow
```

Builds a custom row, or returns null to show the default row.

### Methods [#methods]

#### BluetoothDevicePicker.show [#bluetoothdevicepickershow]

```dart
Future<BluetoothNearbyDevice?> show(
  BuildContext context, {
  ValueChanged<BluetoothNearbyDevice>? onSelect,
  VoidCallback? onDismiss,
  String title = 'Choose a device',
  String dismissLabel = 'Not now',
  String? Function(BluetoothNearbyDevice)? getDeviceImage,
  String Function(BluetoothNearbyDevice)? labelForDevice,
  BluetoothDevicePickerRowBuilder? renderRow,
})
```

Shows the picker as a bottom sheet.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `context` | `BuildContext` | positional |  |
| `onSelect` | `ValueChanged?` | named |  |
| `onDismiss` | `VoidCallback?` | named |  |
| `title` | `String` | named | `'Choose a device'` |
| `dismissLabel` | `String` | named | `'Not now'` |
| `getDeviceImage` | `String? Function(BluetoothNearbyDevice)?` | named |  |
| `labelForDevice` | `String Function(BluetoothNearbyDevice)?` | named |  |
| `renderRow` | `BluetoothDevicePickerRowBuilder?` | named |  |

Returns `Future<BluetoothNearbyDevice?>`.


## BluetoothDevicePickerRowBuilder [#bluetoothdevicepickerrowbuilder]

```dart
typedef BluetoothDevicePickerRowBuilder = Widget Function(BuildContext, BluetoothNearbyDevice, void Function())
```

Builds a custom picker row for one nearby Bluetooth device.
