Files
syncrow-app/lib/features/devices/model/light_model.dart
Mohammad Salameh 4cfae85f9c implemented light brightness slider
optimised state emit to only emit when change is detected
2024-03-03 15:00:13 +03:00

52 lines
1.1 KiB
Dart

import 'package:syncrow_app/features/devices/model/device_model.dart';
class LightModel extends DeviceModel {
late double brightness;
late int color;
late int lightingMode;
LightModel({
required this.brightness,
required this.color,
required this.lightingMode,
required super.id,
required super.name,
required super.type,
required super.status,
required super.location,
required super.image,
required super.timer,
});
Map<String, dynamic> toJson() {
return {
'luminance': brightness,
'color': color,
'lightingMode': lightingMode,
'timer': timer,
'id': id,
'name': name,
'status': status,
'type': type,
'location': location,
'image': image,
};
}
factory LightModel.fromJson(Map<String, dynamic> json) {
return LightModel(
id: json['id'],
name: json['name'],
status: json['status'],
brightness: json['luminance'],
color: json['color'],
lightingMode: json['lightingMode'],
timer: json['timer'],
type: json['type'],
location: json['location'],
image: json['image'],
);
}
}