Refactor device name display in Action and Condition models

This commit is contained in:
mohammad
2025-04-23 10:07:14 +03:00
parent a656d5981e
commit 2b0e504f05
3 changed files with 129 additions and 58 deletions

View File

@ -76,6 +76,8 @@ class Action {
String? type;
final String productType;
final String deviceName;
Action({
required this.actionExecutor,
required this.entityId,
@ -83,6 +85,7 @@ class Action {
this.name,
this.type,
required this.productType,
required this.deviceName,
});
String toRawJson() => json.encode(toJson());
@ -95,6 +98,7 @@ class Action {
name: json['name'] as String?,
type: json['type'] as String?,
productType: json['productType'] as String,
deviceName: json['deviceName'] as String,
);
}
if (json["executorProperty"] == null) {
@ -106,6 +110,7 @@ class Action {
entityId: json["entityId"] as String,
executorProperty: ExecutorProperty.fromJson(json["executorProperty"]),
productType: json['productType'] as String,
deviceName: json['deviceName'] as String,
);
}
@ -147,6 +152,7 @@ class Condition {
final String entityType;
final Expr expr;
final String productType;
final String deviceName;
Condition({
required this.code,
@ -154,6 +160,7 @@ class Condition {
required this.entityType,
required this.expr,
required this.productType,
required this.deviceName,
});
factory Condition.fromRawJson(String str) =>
@ -167,6 +174,7 @@ class Condition {
entityType: json["entityType"],
expr: Expr.fromJson(json["expr"]),
productType: json['productType'] as String,
deviceName: json['deviceName'] as String,
);
Map<String, dynamic> toJson() => {