mobile_skt/lib/models/role.model.dart

46 lines
1.1 KiB
Dart
Raw Normal View History

2024-03-19 08:59:08 +08:00
class RoleModel {
2024-03-28 15:13:27 +08:00
RoleModel({
required this.id,
required this.createdAt,
required this.updatedAt,
required this.name,
required this.value,
required this.remark,
required this.status,
required this.roleDefault,
});
2024-03-19 08:59:08 +08:00
2024-03-28 15:13:27 +08:00
final int? id;
final DateTime? createdAt;
final DateTime? updatedAt;
final String name;
2024-03-28 15:13:27 +08:00
final String? value;
final String? remark;
final int? status;
final dynamic roleDefault;
2024-03-19 08:59:08 +08:00
2024-03-28 15:13:27 +08:00
factory RoleModel.fromJson(Map<String, dynamic> json) {
return RoleModel(
id: json["id"],
createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""),
name: json["name"],
value: json["value"],
remark: json["remark"],
status: json["status"],
roleDefault: json["default"],
);
2024-03-19 08:59:08 +08:00
}
2024-03-28 15:13:27 +08:00
Map<String, dynamic> toJson() => {
"id": id,
"createdAt": createdAt?.toIso8601String(),
"updatedAt": updatedAt?.toIso8601String(),
"name": name,
"value": value,
"remark": remark,
"status": status,
"default": roleDefault,
};
2024-03-19 08:59:08 +08:00
}