BluetoothDevice class

BLE 设备信息模型。

作用:承载扫描到的设备标识、名称与信号强度,供列表展示与连接使用。

调用步骤:

  1. 监听 BluetoothConnect().scanResults 获取设备列表
  2. 展示 name / rssi,用 id 作为连接入参
  3. 调用 BluetoothConnect().connect(device.id) 建立连接

Constructors

BluetoothDevice({required String id, required String name, required int rssi})
const
BluetoothDevice.fromMap(Map map)
从原生 Map 反序列化设备信息。
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
设备唯一标识(Android 多为 MAC,iOS 为系统 UUID)。
final
name String
广播名称,可能为空。
final
rssi int
信号强度(RSSI,数值越大通常信号越好)。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
序列化为 Map,便于调试或二次传递。
toString() String
A string representation of this object.
override

Operators

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