NewsInformationInfoTextModel.dart 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. List<ExtendContent> jsonToList(list){
  2. List<ExtendContent> contList=[];
  3. list.forEach((item){
  4. contList.add(ExtendContent.fromJson(item));
  5. });
  6. return contList;
  7. }
  8. class NewsInformationInfoTextModel {
  9. String? createDate;
  10. String? newsId;
  11. num? status;
  12. String? thumb;
  13. String? title;
  14. String? typeId;
  15. String? typeName;
  16. num? weight;
  17. List<ExtendContent>? contentList=[];
  18. NewsInformationInfoTextModel();
  19. NewsInformationInfoTextModel.fromJson(Map<String, dynamic> json)
  20. : newsId = json["newsId"],
  21. title = json["title"],
  22. typeId = json["typeId"],
  23. typeName = json["typeName"],
  24. thumb = json["thumb"],
  25. weight = json["weight"],
  26. status = json["status"],
  27. createDate = json["createDate"],
  28. contentList= jsonToList(json["contentList"]);
  29. Map<String, dynamic> toJson() => {
  30. 'newsId': newsId,
  31. 'title': title,
  32. 'typeId': typeId,
  33. 'typeName': typeName,
  34. 'thumb': thumb,
  35. 'weight': weight,
  36. 'status': status,
  37. 'createDate': createDate,
  38. };
  39. }
  40. class ExtendContent {
  41. String? content;
  42. String? contentType;
  43. String? createDate;
  44. String? extId;
  45. num? sort;
  46. String? targetId;
  47. String? targetType;
  48. ExtendContent();
  49. ExtendContent.fromJson(Map<String, dynamic> json)
  50. : content = json["content"],
  51. contentType = json["contentType"],
  52. createDate = json["createDate"],
  53. extId = json["extId"],
  54. sort = json["sort"],
  55. targetId = json["targetId"],
  56. targetType = json["targetType;"];
  57. Map<String, dynamic> toJson() => {
  58. 'content': content,
  59. 'contentType': contentType,
  60. 'createDate': createDate,
  61. 'extId': extId,
  62. 'sort': sort,
  63. 'targetId': targetId,
  64. 'targetType': targetType,
  65. };
  66. }