BluetoothDevice class

An immutable snapshot of a remote Bluetooth device.

Identity is the id alone (a device keeps its identity as its name, RSSI or bond state change), matching the convention used by flutter_bluetooth_serial. Instances are snapshots: prefer re-querying over caching mutable fields like rssi or isConnected.

Annotations
  • @immutable

Constructors

BluetoothDevice({required DeviceId id, String? name, BluetoothDeviceType type = BluetoothDeviceType.unknown, BluetoothBondState bondState = BluetoothBondState.unknown, int? rssi, bool isConnected = false, int? deviceClass})
const

Properties

address → String
Convenience for the common MAC-address case.
no setter
bondState → BluetoothBondState
Pairing state.
final
deviceClass → int?
Raw Bluetooth Class-of-Device value, if the platform exposes it.
final
hasAddress → bool
Whether id is a MAC address (true on Windows/Linux/Android/macOS, false for the opaque identifiers used on iOS / address-withheld macOS). Check this before reading address.
no setter
hashCode → int
The hash code for this object.
no setteroverride
id → DeviceId
Stable platform identifier (MAC address or opaque token).
final
isConnected → bool
Whether the OS currently reports an active connection to this device.
final
name → String?
Friendly name, if known. May be null before SDP/name resolution completes.
final
rssi → int?
Signal strength in dBm from the most recent inquiry, if available. Only meaningful on a BluetoothDiscoveryResult; null for bonded lists.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → BluetoothDeviceType
Radio class (classic / le / dual).
final

Methods

copyWith({String? name, BluetoothDeviceType? type, BluetoothBondState? bondState, int? rssi, bool? isConnected, int? deviceClass}) → BluetoothDevice
Returns a copy with the given fields replaced. id is identity and is always preserved (so the copy compares equal to the original).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override