bluetooth_dart library

Cross-platform Bluetooth Low Energy for Dart and Flutter.

bluetooth_dart is pure Dart and has no Flutter dependency, so it works in CLI tools as well as Flutter apps. Native BLE is reached over FFI (the Rust bluetooth_core / btleplug library); see BluetoothBackend for the pluggable backend contract and Bluetooth for the entry point.

Classes

BleCharacteristic
A GATT characteristic and the operations it advertises.
BleConnectionState
A change in the host's connection to a peripheral.
BleDevice
A discovered/updated BLE peripheral.
BleNotification
A notification/indication delivered for a subscribed characteristic.
BlePeripheral
A convenience handle to a single peripheral, wrapping the id-keyed backend operations in an object-oriented surface.
BleService
A GATT service with its characteristics.
Bluetooth
Entry point for Bluetooth LE.
BluetoothBackend
A pluggable provider of Bluetooth LE capability for a platform/technique.
ScanSession
A controllable BLE scan.
UnsupportedBackend
A backend that does nothing, present as the lowest-priority floor so the registry never fails to select something (CI, headless, unsupported platforms). Every operation reports that Bluetooth is unavailable rather than crashing; scans yield no devices.
WebBluetoothGuidance
Actionable, per-browser advice for getting Web Bluetooth working.

Enums

AdapterState
The Bluetooth adapter's power state, delivered on Bluetooth.adapterStates.
PermissionStatus
The OS-level Bluetooth authorization state.
WebBrowser
A web browser, identified so Web Bluetooth guidance can be tailored to it.

Functions

detectWebBrowser() WebBrowser
Identifies the current web browser (see WebBrowser).
webBluetoothGuidance(PermissionStatus status, {WebBrowser? browser}) WebBluetoothGuidance
Builds WebBluetoothGuidance for the current browser and permission status.

Exceptions / Errors

BleException
Thrown when the native BLE layer reports a failure (scan, connect, I/O).
BluetoothException
Base class for all errors thrown by bluetooth_dart.
NoBackendAvailableException
Thrown when no registered backend can run in the current environment.
PermissionDeniedException
Thrown when Bluetooth access is denied or restricted by the OS.