user_profile.g.dart 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/response/user_profile.dart';
  3. UserProfile $UserProfileFromJson(Map<String, dynamic> json) {
  4. final UserProfile userProfile = UserProfile();
  5. final int? id = jsonConvert.convert<int>(json['id']);
  6. if (id != null) {
  7. userProfile.id = id;
  8. }
  9. final String? name = jsonConvert.convert<String>(json['name']);
  10. if (name != null) {
  11. userProfile.name = name;
  12. }
  13. final String? phone = jsonConvert.convert<String>(json['phone']);
  14. if (phone != null) {
  15. userProfile.phone = phone;
  16. }
  17. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  18. if (avatar != null) {
  19. userProfile.avatar = avatar;
  20. }
  21. final String? passwordType = jsonConvert.convert<String>(json['password_type']);
  22. if (passwordType != null) {
  23. userProfile.passwordType = passwordType;
  24. }
  25. final dynamic registrationId = json['registration_id'];
  26. if (registrationId != null) {
  27. userProfile.registrationId = registrationId;
  28. }
  29. return userProfile;
  30. }
  31. Map<String, dynamic> $UserProfileToJson(UserProfile entity) {
  32. final Map<String, dynamic> data = <String, dynamic>{};
  33. data['id'] = entity.id;
  34. data['name'] = entity.name;
  35. data['phone'] = entity.phone;
  36. data['avatar'] = entity.avatar;
  37. data['password_type'] = entity.passwordType;
  38. data['registration_id'] = entity.registrationId;
  39. return data;
  40. }
  41. extension UserProfileExtension on UserProfile {
  42. UserProfile copyWith({
  43. int? id,
  44. String? name,
  45. String? phone,
  46. String? avatar,
  47. String? passwordType,
  48. dynamic registrationId,
  49. }) {
  50. return UserProfile()
  51. ..id = id ?? this.id
  52. ..name = name ?? this.name
  53. ..phone = phone ?? this.phone
  54. ..avatar = avatar ?? this.avatar
  55. ..passwordType = passwordType ?? this.passwordType
  56. ..registrationId = registrationId ?? this.registrationId;
  57. }
  58. }