BluetoothDevice constructor

const BluetoothDevice({
  1. required String id,
  2. String? name,
  3. String? address,
  4. String? type,
  5. bool isConnected = false,
  6. bool isBonded = false,
  7. Map<String, dynamic> raw = const <String, dynamic>{},
})

创建设备信息。

参数:

  • id:设备标识,无默认值。
  • name:设备名称,默认 null,可能因权限或广播缺失而为空。
  • address:设备地址,默认 null。Android 可能等同 MAC;iOS/macOS 通常不公开地址。
  • type:设备类型,默认 null,例如 bleclassic 或平台原生类型。
  • isConnected:是否已连接,默认 false
  • isBonded:是否已绑定/配对,默认 false;主要 Android 有意义。
  • raw:原生完整字段,默认 const <String, dynamic>{},用于排查平台差异。

Implementation

const BluetoothDevice({
  required this.id,
  this.name,
  this.address,
  this.type,
  this.isConnected = false,
  this.isBonded = false,
  this.raw = const <String, dynamic>{},
});