mobile_skt/lib/models/project.model.dart

34 lines
820 B
Dart

class ProjectModel {
ProjectModel({
required this.id,
required this.createdAt,
required this.updatedAt,
required this.name,
required this.isDelete,
});
final int? id;
final DateTime? createdAt;
final DateTime? updatedAt;
final String? name;
final int? isDelete;
factory ProjectModel.fromJson(Map<String, dynamic> json) {
return ProjectModel(
id: json["id"],
createdAt: DateTime.tryParse(json["createdAt"] ?? ""),
updatedAt: DateTime.tryParse(json["updatedAt"] ?? ""),
name: json["name"],
isDelete: json["isDelete"],
);
}
Map<String, dynamic> toJson() => {
"id": id,
"createdAt": createdAt?.toIso8601String(),
"updatedAt": updatedAt?.toIso8601String(),
"name": name,
"isDelete": isDelete,
};
}