user_model.dart 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import 'dart:core';
  2. /// @author: bo.zeng
  3. /// @email: cnhbwds@gmail.com
  4. /// @date: 2025 2025/4/10 12:47
  5. /// @description:
  6. class UserModel {
  7. UserModel({String? nickName, String? description,String? avatar,String? shareUrl,String? shareDesc,String? shopUrl,String? credit,int? isShow}) {
  8. _nickName = nickName;
  9. _description = description;
  10. _avatar = avatar;
  11. _shareUrl = shareUrl;
  12. _credit = credit;
  13. _isShow = isShow;
  14. _shareDesc = shareDesc;
  15. _shopUrl = shopUrl;
  16. }
  17. UserModel.fromJson(dynamic json) {
  18. _nickName = json['nickName'];
  19. _description = json['description'];
  20. _avatar = json['avatar'];
  21. _shareUrl = json['shareUrl'];
  22. _credit = json['credit'];
  23. _isShow = json['isShow'];
  24. _shareDesc = json['shareDesc'];
  25. _shopUrl = json['shopUrl'];
  26. }
  27. String? _nickName;
  28. String? _description;
  29. String? _avatar;
  30. String? _shareUrl;
  31. String? _credit;
  32. int? _isShow;
  33. String? _shareDesc;
  34. String? _shopUrl;
  35. UserModel copyWith({String? nickName, String? description,String? avatar,String? credit,String? shareUrl,String? shareDesc,String? shopUrl,int? isShow}) => UserModel(
  36. nickName: nickName ?? _nickName,
  37. description: description ?? _description,
  38. avatar:avatar ?? _avatar,
  39. shareUrl:shareUrl ?? _shareUrl,
  40. shareDesc:shareDesc ?? _shareDesc,
  41. credit:credit ?? _credit,
  42. isShow:isShow ?? _isShow,
  43. shopUrl:shopUrl ?? _shopUrl,
  44. );
  45. String? get nickName => _nickName;
  46. String? get description => _description;
  47. String? get avatar => _avatar;
  48. String? get shareUrl => _shareUrl;
  49. String? get shareDesc => _shareDesc;
  50. String? get credit => _credit;
  51. int? get isShow => _isShow;
  52. String? get shopUrl=> _shopUrl;
  53. Map<String, dynamic> toJson() {
  54. final map = <String, dynamic>{};
  55. map['nickName'] = _nickName;
  56. map['description'] = _description;
  57. map['avatar'] = _avatar;
  58. map['shareUrl'] = _shareUrl;
  59. map['shareDesc'] = _shareDesc;
  60. map['credit'] = _credit;
  61. map['isShow'] = _isShow;
  62. map['shopUrl'] = _shopUrl;
  63. return map;
  64. }
  65. }