Runtime
Generated reference for ovok_flutter: runtime.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.27+7d4ccf0
BluetoothRuntime
class BluetoothRuntimeScans for supported devices, connects, reads measurements and saves each one.
Constructors
BluetoothRuntime.new
BluetoothRuntime(BluetoothRuntimeOptions options)Creates a runtime from platform ports and matching device drivers.
| Parameter | Type | Kind | Default |
|---|---|---|---|
options | BluetoothRuntimeOptions | positional |
Methods
BluetoothRuntime.getSnapshot
BluetoothSnapshot getSnapshot()The current immutable runtime snapshot.
Returns BluetoothSnapshot.
BluetoothRuntime.subscribe
Stream<BluetoothSnapshot> subscribe()Emits the current snapshot followed by every state change.
Returns Stream<BluetoothSnapshot>.
BluetoothRuntime.checkPermission
Future<BluetoothPermission> checkPermission()Reads Bluetooth permission without prompting.
Returns Future<BluetoothPermission>.
BluetoothRuntime.requestPermission
Future<BluetoothPermission> requestPermission()Prompts for Bluetooth permission when the operating system permits it.
Returns Future<BluetoothPermission>.
BluetoothRuntime.openPermissionSettings
Future<void> openPermissionSettings()Opens the app's system settings.
Returns Future<void>.
BluetoothRuntime.startScan
Future<void> startScan()Requests permission if needed, then scans whenever Bluetooth is on.
Returns Future<void>.
BluetoothRuntime.stopScan
void stopScan()Stops scanning while leaving connected devices active.
Returns void.
BluetoothRuntime.connect
Future<void> connect(String deviceId)Connects to a supported device found by a scan.
| Parameter | Type | Kind | Default |
|---|---|---|---|
deviceId | String | positional |
Returns Future<void>.
BluetoothRuntime.disconnect
Future<void> disconnect(String deviceId)Disconnects a device and suspends automatic reconnects for this session.
| Parameter | Type | Kind | Default |
|---|---|---|---|
deviceId | String | positional |
Returns Future<void>.
BluetoothRuntime.pair
Future<void> pair(String deviceId)Remembers and connects to a device, including after later scans.
| Parameter | Type | Kind | Default |
|---|---|---|---|
deviceId | String | positional |
Returns Future<void>.
BluetoothRuntime.forget
Future<void> forget(String deviceId)Forgets a paired device and disconnects it.
| Parameter | Type | Kind | Default |
|---|---|---|---|
deviceId | String | positional |
Returns Future<void>.
BluetoothRuntime.retrySaves
Future<void> retrySaves()Retries failed saves and flushes the sink's offline queue.
Returns Future<void>.
BluetoothRuntime.dispose
Future<void> dispose()Stops scanning and waits for every device to disconnect.
Returns Future<void>.
BluetoothRuntimeOptions
class BluetoothRuntimeOptionsDependencies for a BluetoothRuntime.
Constructors
BluetoothRuntimeOptions.new
BluetoothRuntimeOptions({
required BluetoothScanner scanner,
required BluetoothPermissions permissions,
required BluetoothReadingSink sink,
required Iterable<BluetoothDeviceSupport> devices,
ResultPolicy? resultPolicy,
OvokSecureStore? pairedStorage,
})Creates a runtime configuration from platform ports and device support.
| Parameter | Type | Kind | Default |
|---|---|---|---|
scanner | BluetoothScanner | required named | |
permissions | BluetoothPermissions | required named | |
sink | BluetoothReadingSink | required named | |
devices | Iterable<BluetoothDeviceSupport> | required named | |
resultPolicy | ResultPolicy? | named | |
pairedStorage | OvokSecureStore? | named |
Properties
BluetoothRuntimeOptions.scanner
final BluetoothScanner scannerThe BLE adapter.
BluetoothRuntimeOptions.permissions
final BluetoothPermissions permissionsThe operating system permission prompts.
BluetoothRuntimeOptions.sink
final BluetoothReadingSink sinkWhere device readings are saved.
BluetoothRuntimeOptions.devices
final List<BluetoothDeviceSupport> devicesThe device drivers considered by the runtime, in match priority order.
BluetoothRuntimeOptions.resultPolicy
final ResultPolicy? resultPolicySelects readings to save; defaults to every reading.
BluetoothRuntimeOptions.pairedStorage
final OvokSecureStore? pairedStorageSecure storage for paired device IDs; pairing lasts for this session if omitted.
Last updated on