32 lines
781 B
Dart
32 lines
781 B
Dart
class ServiceSettingDto {
|
|
final String key;
|
|
final String value;
|
|
final String type; // 'bool', 'int', 'double', 'string'
|
|
final String description;
|
|
|
|
const ServiceSettingDto({
|
|
required this.key,
|
|
required this.value,
|
|
this.type = 'string',
|
|
this.description = '',
|
|
});
|
|
|
|
factory ServiceSettingDto.fromJson(Map<String, dynamic> json) {
|
|
return ServiceSettingDto(
|
|
key: json['key']?.toString() ?? '',
|
|
value: json['value']?.toString() ?? '',
|
|
type: json['dataType']?.toString() ?? json['type']?.toString() ?? 'string',
|
|
description: json['description']?.toString() ?? '',
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'key': key,
|
|
'value': value,
|
|
'type': type,
|
|
'description': description,
|
|
};
|
|
}
|
|
}
|