bluetooth_device_info.dart 509 B

12345678910111213141516
  1. /// A Bluetooth Classic device already paired with the tablet.
  2. class BluetoothDeviceInfo {
  3. const BluetoothDeviceInfo({required this.name, required this.address});
  4. final String name;
  5. final String address;
  6. factory BluetoothDeviceInfo.fromMap(Map<dynamic, dynamic> map) {
  7. return BluetoothDeviceInfo(
  8. name: (map['name'] as String?)?.trim() ?? 'Unknown device',
  9. address: (map['address'] as String?) ?? '',
  10. );
  11. }
  12. String get label => name.isEmpty ? address : '$name · $address';
  13. }