user_xieyi_model.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import 'dart:convert' show json;
  2. T asT<T>(dynamic value) {
  3. if (value is T) {
  4. return value;
  5. }
  6. return null;
  7. }
  8. class UserXieyi {
  9. UserXieyi({
  10. this.id,
  11. this.createTime,
  12. this.createBy,
  13. this.updateTime,
  14. this.updateBy,
  15. this.name,
  16. this.createUserId,
  17. this.url,
  18. this.fileName,
  19. this.template,
  20. this.statuz,
  21. this.type,
  22. this.nickname,
  23. this.headUrl,
  24. });
  25. factory UserXieyi.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
  26. ? null
  27. : UserXieyi(
  28. id: asT<int>(jsonRes['id']),
  29. createTime: asT<int>(jsonRes['createTime']),
  30. createBy: asT<Object>(jsonRes['createBy']),
  31. updateTime: asT<int>(jsonRes['updateTime']),
  32. updateBy: asT<Object>(jsonRes['updateBy']),
  33. name: asT<String>(jsonRes['name']),
  34. createUserId: asT<String>(jsonRes['createUserId']),
  35. url: asT<String>(jsonRes['url']),
  36. fileName: asT<String>(jsonRes['fileName']),
  37. template: asT<Object>(jsonRes['template']),
  38. statuz: asT<int>(jsonRes['statuz']),
  39. type: asT<int>(jsonRes['type']),
  40. nickname: asT<String>(jsonRes['nickname']),
  41. headUrl: asT<String>(jsonRes['headUrl']),
  42. );
  43. int id;
  44. int createTime;
  45. Object createBy;
  46. int updateTime;
  47. Object updateBy;
  48. String name;
  49. String createUserId;
  50. String url;
  51. String fileName;
  52. Object template;
  53. int statuz;
  54. int type;
  55. String nickname;
  56. String headUrl;
  57. Map<String, dynamic> toJson() => <String, dynamic>{
  58. 'id': id,
  59. 'createTime': createTime,
  60. 'createBy': createBy,
  61. 'updateTime': updateTime,
  62. 'updateBy': updateBy,
  63. 'name': name,
  64. 'createUserId': createUserId,
  65. 'url': url,
  66. 'fileName': fileName,
  67. 'template': template,
  68. 'statuz': statuz,
  69. 'type': type,
  70. 'nickname': nickname,
  71. 'headUrl': headUrl,
  72. };
  73. @override
  74. String toString() {
  75. return json.encode(this);
  76. }
  77. }