mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 20:44:54 +00:00
fixed automation
This commit is contained in:
@ -3,32 +3,40 @@ import 'dart:typed_data';
|
||||
|
||||
class ScenesModel {
|
||||
final String id;
|
||||
final String? sceneTuyaId;
|
||||
final String name;
|
||||
final String status;
|
||||
final String type;
|
||||
final String icon;
|
||||
final String? icon;
|
||||
|
||||
ScenesModel(
|
||||
{required this.id,
|
||||
this.sceneTuyaId,
|
||||
required this.name,
|
||||
required this.status,
|
||||
required this.type,
|
||||
required this.icon});
|
||||
this.icon});
|
||||
|
||||
factory ScenesModel.fromRawJson(String str) => ScenesModel.fromJson(json.decode(str));
|
||||
factory ScenesModel.fromRawJson(String str) =>
|
||||
ScenesModel.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
Uint8List get iconInBytes => base64Decode(icon);
|
||||
|
||||
factory ScenesModel.fromJson(Map<String, dynamic> json) => ScenesModel(
|
||||
id: json["uuid"],
|
||||
name: json["name"] ?? '',
|
||||
status: json["status"] ?? '',
|
||||
type: json["type"] ?? '',
|
||||
icon: json["icon"] ?? '');
|
||||
Uint8List get iconInBytes => base64Decode(icon ?? '');
|
||||
|
||||
factory ScenesModel.fromJson(Map<String, dynamic> json) {
|
||||
return ScenesModel(
|
||||
id: json["id"] ?? json["uuid"] ?? '', // Fallback to empty string if id is null
|
||||
sceneTuyaId: json["sceneTuyaId"] as String?, // Nullable
|
||||
name: json["name"] ?? '', // Fallback to empty string if name is null
|
||||
status:
|
||||
json["status"] ?? '', // Fallback to empty string if status is null
|
||||
type: json["type"] ?? '', // Fallback to empty string if type is null
|
||||
icon: json["icon"] as String?, // Nullable
|
||||
);
|
||||
}
|
||||
Map<String, dynamic> toJson() => {
|
||||
"id": id,
|
||||
"sceneTuyaId": sceneTuyaId ?? '',
|
||||
"name": name,
|
||||
"status": status,
|
||||
"type": type,
|
||||
|
||||
Reference in New Issue
Block a user