BleCentralPlatform class abstract

The backend contract a platform implements. App code uses BleCentral, not this directly — but it's exported so advanced users can supply a custom backend or a test fake via BleCentral(platform: ...).

Implementers

Constructors

BleCentralPlatform()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

adapterState() Future<BluetoothAdapterState>
adapterStateChanges() Stream<BluetoothAdapterState>
Adapter-state stream. Always emits the current state on listen. Live transition events are emitted by the Linux (BlueZ) backend; macOS, iOS, Android and Windows currently emit the current state once (continuous change events on those platforms are a future enhancement). Use adapterState for a one-shot snapshot.
connect(DeviceId id, {Duration? timeout}) Future<GattConnection>
Opens a GATT connection to the device with id.
dispose() Future<void>
Releases global resources held by the backend.
isSupported() Future<bool>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAdapterEnabled(bool enabled) Future<void>
startScan({List<Uuid>? withServices}) Stream<BleScanResult>
Streams advertisement sightings, optionally filtered to withServices. Cancelling the subscription (or stopScan) stops the scan.
stopScan() Future<void>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance BleCentralPlatform
The host-appropriate backend, created lazily. Settable for tests.
getter/setter pair

Static Methods

detachInstance(BleCentralPlatform platform) → void
Detaches platform from the shared instance slot if it currently occupies it, so the next instance read builds a fresh backend instead of handing out a disposed one. Platform implementations call this from their dispose(); a no-op when platform is not the shared instance.