Bluetooth device picker

Generated reference for ovok_flutter: bluetooth device picker.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.29+c3980d5

BluetoothDevicePicker

class BluetoothDevicePicker extends StatelessWidget

Lists nearby supported devices and connects to the selected device.

Constructors

BluetoothDevicePicker.new

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.

ParameterTypeKindDefault
onSelectValueChanged?named
onDismissVoidCallback?named
titleStringnamed'Choose a device'
dismissLabelStringnamed'Not now'
getDeviceImageString? Function(BluetoothNearbyDevice)?named
labelForDeviceString Function(BluetoothNearbyDevice)?named
renderRowBluetoothDevicePickerRowBuilder?named
keyKey?named

Properties

BluetoothDevicePicker.onSelect

final ValueChanged? onSelect

Called when a selected device starts connecting.

BluetoothDevicePicker.onDismiss

final VoidCallback? onDismiss

Called when the picker is dismissed without selecting a device.

BluetoothDevicePicker.title

final String title

The picker heading.

BluetoothDevicePicker.dismissLabel

final String dismissLabel

The dismiss button label.

BluetoothDevicePicker.getDeviceImage

final String? Function(BluetoothNearbyDevice)? getDeviceImage

Returns an optional device image URL.

BluetoothDevicePicker.labelForDevice

final String Function(BluetoothNearbyDevice)? labelForDevice

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

BluetoothDevicePicker.renderRow

final BluetoothDevicePickerRowBuilder? renderRow

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

Methods

BluetoothDevicePicker.show

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.

ParameterTypeKindDefault
contextBuildContextpositional
onSelectValueChanged?named
onDismissVoidCallback?named
titleStringnamed'Choose a device'
dismissLabelStringnamed'Not now'
getDeviceImageString? Function(BluetoothNearbyDevice)?named
labelForDeviceString Function(BluetoothNearbyDevice)?named
renderRowBluetoothDevicePickerRowBuilder?named

Returns Future<BluetoothNearbyDevice?>.

BluetoothDevicePickerRowBuilder

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

Builds a custom picker row for one nearby Bluetooth device.

Last updated on

On this page