Files
syncrow-app/lib/features/devices/model/function_model.dart

68 lines
1.2 KiB
Dart

import 'package:syncrow_app/utils/resource_manager/constants.dart';
class FunctionModel {
String? code;
FunctionType? type;
dynamic values;
FunctionModel({
required this.code,
required this.type,
required this.values,
});
factory FunctionModel.fromJson(Map<String, dynamic> json) {
return FunctionModel(
code: json['code'],
type: json['type'],
values: json['values'],
);
}
Map<String, dynamic> toJson() {
return {
'code': code,
'type': type,
'values': values,
};
}
}
//"values": "{\"unit\":\"\",\"min\":1,\"max\":10,\"scale\":0,\"step\":1}",
class ValueModel {
String? unit;
int? min;
int? max;
int? scale;
int? step;
ValueModel({
required this.unit,
required this.min,
required this.max,
required this.scale,
required this.step,
});
factory ValueModel.fromJson(Map<String, dynamic> json) {
return ValueModel(
unit: json['unit'],
min: json['min'],
max: json['max'],
scale: json['scale'],
step: json['step'],
);
}
Map<String, dynamic> toJson() {
return {
'unit': unit,
'min': min,
'max': max,
'scale': scale,
'step': step,
};
}
}