Ports

Generated reference for ovok_flutter: ports.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.27+7d4ccf0

BluetoothCancellation

class BluetoothCancellation

Cancels a pending peripheral connection or device driver.

Constructors

BluetoothCancellation.new

BluetoothCancellation()

Properties

BluetoothCancellation.isCancelled

bool get isCancelled

Whether cancellation has been requested.

BluetoothCancellation.whenCancelled

Future<void> get whenCancelled

Completes when cancellation is requested.

Methods

BluetoothCancellation.cancel

void cancel()

Requests cancellation once.

Returns void.

abstract interface class BluetoothLink

An open GATT connection that can read and write characteristics.

Methods

BluetoothLink.subscribe

Stream<List<int>> subscribe(String service, String characteristic)

Listens to notifications or indications for one characteristic.

ParameterTypeKindDefault
serviceStringpositional
characteristicStringpositional

Returns Stream<List<int>>.

BluetoothLink.write

Future<void> write(
  String service,
  String characteristic,
  List<int> bytes,
)

Writes bytes to a characteristic with response.

ParameterTypeKindDefault
serviceStringpositional
characteristicStringpositional
bytesList<int>positional

Returns Future<void>.

BluetoothLink.close

Future<void> close()

Cancels subscriptions and disconnects.

Returns Future<void>.

BluetoothPeripheral

abstract interface class BluetoothPeripheral

A Bluetooth peripheral discovered by a BluetoothScanner.

Properties

BluetoothPeripheral.id

String get id

The platform identifier for this peripheral.

BluetoothPeripheral.advertisement

BluetoothAdvertisement get advertisement

What this peripheral advertises.

Methods

Future<BluetoothLink> openLink(BluetoothCancellation cancellation)

Connects and discovers services, stopping if cancellation is requested.

ParameterTypeKindDefault
cancellationBluetoothCancellationpositional

Returns Future<BluetoothLink>.

BluetoothPermissions

abstract interface class BluetoothPermissions

Bluetooth permission checks and system prompts.

Methods

BluetoothPermissions.check

Future<BluetoothPermission> check()

Reads the current permission without prompting.

Returns Future<BluetoothPermission>.

BluetoothPermissions.request

Future<BluetoothPermission> request()

Prompts for Bluetooth permission when the operating system permits it.

Returns Future<BluetoothPermission>.

BluetoothPermissions.openSettings

Future<void> openSettings()

Opens the app's system settings.

Returns Future<void>.

BluetoothReadingSink

abstract interface class BluetoothReadingSink

Stores measurements reported by Bluetooth devices.

Methods

BluetoothReadingSink.save

Future<BluetoothSaveResult> save(BluetoothDeviceReading reading)

Saves a reading or queues it for an offline retry.

ParameterTypeKindDefault
readingBluetoothDeviceReadingpositional

Returns Future<BluetoothSaveResult>.

BluetoothReadingSink.flushQueued

Future<List<String>> flushQueued()

Retries queued readings and returns the IDs that were saved.

Returns Future<List<String>>.

BluetoothSaveResult

class BluetoothSaveResult

A completed measurement save.

Constructors

BluetoothSaveResult.saved

BluetoothSaveResult.saved()

Creates a saved result.

BluetoothSaveResult.queued

BluetoothSaveResult.queued(String queueId)

Creates an offline queued result.

ParameterTypeKindDefault
queueIdStringpositional

Properties

BluetoothSaveResult.status

final BluetoothSaveStatus status

The save outcome.

BluetoothSaveResult.queueId

final String? queueId

The offline queue ID when queued.

BluetoothScanner

abstract interface class BluetoothScanner

The platform adapter's state and scan stream.

Properties

BluetoothScanner.state

BluetoothAdapterState get state

The adapter's current state.

BluetoothScanner.stateChanges

Stream<BluetoothAdapterState> get stateChanges

Adapter state changes, including the first state when the stream is listened to.

Methods

BluetoothScanner.scan

Stream<BluetoothPeripheral> scan()

Scans until the listener cancels or an error occurs.

Returns Stream<BluetoothPeripheral>.

Last updated on

On this page