Files
TimbanganSiab/lib/models/registered_device.dart
2026-01-29 16:17:31 +07:00

42 lines
869 B
Dart

/// A SIAB device registered in local SQLite with a user-assigned label.
/// Stores only a user label (\"Label ID\") and the device UUID.
class RegisteredDevice {
final int? id;
final String uuid;
final String label;
RegisteredDevice({
this.id,
required this.uuid,
required this.label,
});
Map<String, dynamic> toMap() {
return {
if (id != null) 'id': id,
'uuid': uuid,
'label': label,
};
}
static RegisteredDevice fromMap(Map<String, dynamic> map) {
return RegisteredDevice(
id: map['id'] as int?,
uuid: map['uuid'] as String,
label: map['label'] as String,
);
}
RegisteredDevice copyWith({
int? id,
String? uuid,
String? label,
}) {
return RegisteredDevice(
id: id ?? this.id,
uuid: uuid ?? this.uuid,
label: label ?? this.label,
);
}
}