Models

Generated reference for ovok_flutter: models.

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

BluetoothAdapterState

enum BluetoothAdapterState

The state of the device's Bluetooth adapter.

Values

BluetoothAdapterState.unknown

static const BluetoothAdapterState unknown

The platform has not reported its adapter state yet.

BluetoothAdapterState.on

static const BluetoothAdapterState on

Bluetooth is ready for use.

BluetoothAdapterState.off

static const BluetoothAdapterState off

Bluetooth is turned off.

BluetoothAdapterState.unauthorized

static const BluetoothAdapterState unauthorized

The app is not authorized to use Bluetooth.

BluetoothAdapterState.unsupported

static const BluetoothAdapterState unsupported

This device does not support Bluetooth LE.

BluetoothAdvertisement

class BluetoothAdvertisement

What a peripheral advertised during scanning.

Constructors

BluetoothAdvertisement.new

BluetoothAdvertisement({
  required String name,
  required Iterable<String> serviceUuids,
  String? manufacturerData,
})

Creates an advertisement snapshot.

ParameterTypeKindDefault
nameStringrequired named
serviceUuidsIterable<String>required named
manufacturerDataString?named

Properties

BluetoothAdvertisement.name

final String name

The advertised name, or an empty string when unavailable.

BluetoothAdvertisement.serviceUuids

final List<String> serviceUuids

The advertised service UUIDs.

BluetoothAdvertisement.manufacturerData

final String? manufacturerData

The base64 encoded manufacturer data, or null when absent.

BluetoothConnectionState

enum BluetoothConnectionState

The state of a supported nearby device.

Values

BluetoothConnectionState.idle

static const BluetoothConnectionState idle

The device has not started connecting.

BluetoothConnectionState.connecting

static const BluetoothConnectionState connecting

The runtime is opening the device connection.

BluetoothConnectionState.connected

static const BluetoothConnectionState connected

The device connection is open.

BluetoothConnectionState.measuring

static const BluetoothConnectionState measuring

The device is sending measurements.

BluetoothConnectionState.disconnected

static const BluetoothConnectionState disconnected

The device connection is closed.

BluetoothConnectionState.failed

static const BluetoothConnectionState failed

The device connection failed.

BluetoothDeviceReading

class BluetoothDeviceReading

A measurement reported by a supported Bluetooth device.

Constructors

BluetoothDeviceReading.new

BluetoothDeviceReading({
  required String id,
  required BluetoothReadingDevice device,
  required JsonMap measurement,
  required DateTime receivedAt,
  required BluetoothSaveState save,
})

Creates a device reading snapshot.

ParameterTypeKindDefault
idStringrequired named
deviceBluetoothReadingDevicerequired named
measurementJsonMaprequired named
receivedAtDateTimerequired named
saveBluetoothSaveStaterequired named

Properties

BluetoothDeviceReading.id

final String id

A reading ID; timestamped readings use the same ID when resent.

BluetoothDeviceReading.device

final BluetoothReadingDevice device

The device that produced the reading.

BluetoothDeviceReading.measurement

final JsonMap measurement

The decoded Ovok measurement.

BluetoothDeviceReading.receivedAt

final DateTime receivedAt

When this app received the reading.

BluetoothDeviceReading.save

final BluetoothSaveState save

Whether the measurement was saved.

Methods

BluetoothDeviceReading.copyWith

BluetoothDeviceReading copyWith({required BluetoothSaveState save})

Returns a copy with the supplied save state.

ParameterTypeKindDefault
saveBluetoothSaveStaterequired named

Returns BluetoothDeviceReading.

BluetoothNearbyDevice

class BluetoothNearbyDevice

A supported peripheral discovered by a scan.

Constructors

BluetoothNearbyDevice.new

BluetoothNearbyDevice({
  required String id,
  required String key,
  required String name,
  required BluetoothConnectionState connection,
  BluetoothError? error,
})

Creates a nearby device snapshot.

ParameterTypeKindDefault
idStringrequired named
keyStringrequired named
nameStringrequired named
connectionBluetoothConnectionStaterequired named
errorBluetoothError?named

Properties

BluetoothNearbyDevice.id

final String id

The platform identifier for the peripheral.

BluetoothNearbyDevice.key

final String key

The device key reported with its readings.

BluetoothNearbyDevice.name

final String name

The name from its advertisement.

BluetoothNearbyDevice.connection

final BluetoothConnectionState connection

The current connection state.

BluetoothNearbyDevice.error

final BluetoothError? error

The last connection error, when one occurred.

Methods

BluetoothNearbyDevice.copyWith

BluetoothNearbyDevice copyWith({
  String? name,
  BluetoothConnectionState? connection,
  BluetoothError? error,
  bool clearError = false,
})

Returns a copy with the supplied fields changed.

ParameterTypeKindDefault
nameString?named
connectionBluetoothConnectionState?named
errorBluetoothError?named
clearErrorboolnamedfalse

Returns BluetoothNearbyDevice.

BluetoothPermission

enum BluetoothPermission

The app's Bluetooth permission state.

Values

BluetoothPermission.unknown

static const BluetoothPermission unknown

The runtime has not checked permission yet.

BluetoothPermission.granted

static const BluetoothPermission granted

Bluetooth access is permitted.

BluetoothPermission.denied

static const BluetoothPermission denied

The user can still be asked for access.

BluetoothPermission.blocked

static const BluetoothPermission blocked

Only system settings can grant access.

BluetoothReadingDevice

class BluetoothReadingDevice

The identity of the device that produced a reading.

Constructors

BluetoothReadingDevice.new

BluetoothReadingDevice({
  required String id,
  required String key,
  required String name,
})

Creates a device identity for a reading.

ParameterTypeKindDefault
idStringrequired named
keyStringrequired named
nameStringrequired named

Properties

BluetoothReadingDevice.id

final String id

The platform identifier for the peripheral.

BluetoothReadingDevice.key

final String key

The device key reported with its readings.

BluetoothReadingDevice.name

final String name

The name from its advertisement.

BluetoothSaveState

class BluetoothSaveState

The outcome of saving a device reading.

Constructors

BluetoothSaveState.saving

BluetoothSaveState.saving()

Creates a reading that is waiting for a save result.

BluetoothSaveState.saved

BluetoothSaveState.saved()

Creates a reading that was saved.

BluetoothSaveState.queued

BluetoothSaveState.queued(String queueId)

Creates a reading queued for an offline retry.

ParameterTypeKindDefault
queueIdStringpositional

BluetoothSaveState.failed

BluetoothSaveState.failed(BluetoothError error)

Creates a reading whose save failed and can be retried.

ParameterTypeKindDefault
errorBluetoothErrorpositional

Properties

BluetoothSaveState.status

final BluetoothSaveStatus status

The save state.

BluetoothSaveState.queueId

final String? queueId

The offline queue ID when status is queued.

BluetoothSaveState.error

final BluetoothError? error

The failure when status is failed.

BluetoothSaveStatus

enum BluetoothSaveStatus

Whether a device reading was saved or needs another attempt.

Values

BluetoothSaveStatus.saving

static const BluetoothSaveStatus saving

The sink has not answered yet.

BluetoothSaveStatus.saved

static const BluetoothSaveStatus saved

The sink saved the reading.

BluetoothSaveStatus.queued

static const BluetoothSaveStatus queued

The sink queued the reading for a later retry.

BluetoothSaveStatus.failed

static const BluetoothSaveStatus failed

The sink could not save or queue the reading.

BluetoothSnapshot

class BluetoothSnapshot

A consistent view of the Bluetooth runtime's current state.

Constructors

BluetoothSnapshot.new

BluetoothSnapshot({
  required BluetoothAdapterState adapter,
  required BluetoothPermission permission,
  required bool scanning,
  required BluetoothError? scanError,
  required Iterable<BluetoothNearbyDevice> devices,
  required Iterable<String> paired,
  required Iterable<BluetoothDeviceReading> readings,
})

Creates an immutable runtime snapshot.

ParameterTypeKindDefault
adapterBluetoothAdapterStaterequired named
permissionBluetoothPermissionrequired named
scanningboolrequired named
scanErrorBluetoothError?required named
devicesIterable<BluetoothNearbyDevice>required named
pairedIterable<String>required named
readingsIterable<BluetoothDeviceReading>required named

Properties

BluetoothSnapshot.adapter

final BluetoothAdapterState adapter

The current Bluetooth adapter state.

BluetoothSnapshot.permission

final BluetoothPermission permission

The last observed Bluetooth permission state.

BluetoothSnapshot.scanning

final bool scanning

Whether scanning has been requested.

BluetoothSnapshot.scanError

final BluetoothError? scanError

The last scan error, when one occurred.

BluetoothSnapshot.devices

final List<BluetoothNearbyDevice> devices

Supported peripherals, in discovery order.

BluetoothSnapshot.paired

final List<String> paired

Paired device IDs.

BluetoothSnapshot.readings

final List<BluetoothDeviceReading> readings

Recent readings, oldest first.

Methods

BluetoothSnapshot.device

BluetoothNearbyDevice? device(String id)

Finds a nearby device by id.

ParameterTypeKindDefault
idStringpositional

Returns BluetoothNearbyDevice?.

BluetoothSnapshot.copyWith

BluetoothSnapshot copyWith({
  BluetoothAdapterState? adapter,
  BluetoothPermission? permission,
  bool? scanning,
  BluetoothError? scanError,
  bool clearScanError = false,
  Iterable<BluetoothNearbyDevice>? devices,
  Iterable<String>? paired,
  Iterable<BluetoothDeviceReading>? readings,
})

Returns a new snapshot with selected fields replaced.

ParameterTypeKindDefault
adapterBluetoothAdapterState?named
permissionBluetoothPermission?named
scanningbool?named
scanErrorBluetoothError?named
clearScanErrorboolnamedfalse
devicesIterable<BluetoothNearbyDevice>?named
pairedIterable<String>?named
readingsIterable<BluetoothDeviceReading>?named

Returns BluetoothSnapshot.

Last updated on

On this page

BluetoothAdapterStateValuesBluetoothAdapterState.unknownBluetoothAdapterState.onBluetoothAdapterState.offBluetoothAdapterState.unauthorizedBluetoothAdapterState.unsupportedBluetoothAdvertisementConstructorsBluetoothAdvertisement.newPropertiesBluetoothAdvertisement.nameBluetoothAdvertisement.serviceUuidsBluetoothAdvertisement.manufacturerDataBluetoothConnectionStateValuesBluetoothConnectionState.idleBluetoothConnectionState.connectingBluetoothConnectionState.connectedBluetoothConnectionState.measuringBluetoothConnectionState.disconnectedBluetoothConnectionState.failedBluetoothDeviceReadingConstructorsBluetoothDeviceReading.newPropertiesBluetoothDeviceReading.idBluetoothDeviceReading.deviceBluetoothDeviceReading.measurementBluetoothDeviceReading.receivedAtBluetoothDeviceReading.saveMethodsBluetoothDeviceReading.copyWithBluetoothNearbyDeviceConstructorsBluetoothNearbyDevice.newPropertiesBluetoothNearbyDevice.idBluetoothNearbyDevice.keyBluetoothNearbyDevice.nameBluetoothNearbyDevice.connectionBluetoothNearbyDevice.errorMethodsBluetoothNearbyDevice.copyWithBluetoothPermissionValuesBluetoothPermission.unknownBluetoothPermission.grantedBluetoothPermission.deniedBluetoothPermission.blockedBluetoothReadingDeviceConstructorsBluetoothReadingDevice.newPropertiesBluetoothReadingDevice.idBluetoothReadingDevice.keyBluetoothReadingDevice.nameBluetoothSaveStateConstructorsBluetoothSaveState.savingBluetoothSaveState.savedBluetoothSaveState.queuedBluetoothSaveState.failedPropertiesBluetoothSaveState.statusBluetoothSaveState.queueIdBluetoothSaveState.errorBluetoothSaveStatusValuesBluetoothSaveStatus.savingBluetoothSaveStatus.savedBluetoothSaveStatus.queuedBluetoothSaveStatus.failedBluetoothSnapshotConstructorsBluetoothSnapshot.newPropertiesBluetoothSnapshot.adapterBluetoothSnapshot.permissionBluetoothSnapshot.scanningBluetoothSnapshot.scanErrorBluetoothSnapshot.devicesBluetoothSnapshot.pairedBluetoothSnapshot.readingsMethodsBluetoothSnapshot.deviceBluetoothSnapshot.copyWith