post_user.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import 'package:sport/services/Converter.dart';
  2. class PostUser {
  3. String id;
  4. String name;
  5. String level;
  6. String score;
  7. String isBan;
  8. String provinceId;
  9. String cityId;
  10. String districtId;
  11. int gender;
  12. int age;
  13. String avatar;
  14. PostUser(
  15. {this.id,
  16. this.name,
  17. this.level,
  18. this.score,
  19. this.isBan,
  20. this.provinceId,
  21. this.cityId,
  22. this.districtId,
  23. this.gender,
  24. this.age,
  25. this.avatar});
  26. PostUser.fromJson(Map<String, dynamic> json) {
  27. id = json['id'];
  28. name = json['name'];
  29. level = json['level'];
  30. score = json['score'];
  31. isBan = json['is_ban'];
  32. provinceId = json['province_id'];
  33. cityId = json['city_id'];
  34. districtId = json['district_id'];
  35. gender = Converter.toInt(json['gender']);
  36. age = Converter.toInt(json['age']);
  37. avatar = json['avatar'];
  38. }
  39. Map<String, dynamic> toJson() {
  40. final Map<String, dynamic> data = new Map<String, dynamic>();
  41. data['id'] = this.id;
  42. data['name'] = this.name;
  43. data['level'] = this.level;
  44. data['score'] = this.score;
  45. data['is_ban'] = this.isBan;
  46. data['province_id'] = this.provinceId;
  47. data['city_id'] = this.cityId;
  48. data['district_id'] = this.districtId;
  49. data['gender'] = this.gender;
  50. data['age'] = this.age;
  51. data['avatar'] = this.avatar;
  52. return data;
  53. }
  54. }