Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. class RandomUser {
  2. List<Results> users;
  3.  
  4. RandomUser({this.users});
  5.  
  6. RandomUser.fromJson(Map<String, dynamic> json) {
  7. if (json['results'] != null) {
  8. users = new List<Results>();
  9. json['results'].forEach((v) {
  10. users.add(new Results.fromJson(v));
  11. });
  12. }
  13. }
  14. }
  15.  
  16. class Results {
  17. Name name;
  18. Location location;
  19. Picture picture;
  20.  
  21. Results(
  22. {
  23. this.name,
  24. this.location,
  25. this.picture});
  26.  
  27. Results.fromJson(Map<String, dynamic> json) {
  28. name = json['name'] != null ? new Name.fromJson(json['name']) : null;
  29. location = json['location'] != null
  30. ? new Location.fromJson(json['location'])
  31. : null;
  32. picture =
  33. json['picture'] != null ? new Picture.fromJson(json['picture']) : null;
  34. }
  35. }
  36.  
  37. class Name {
  38. String title;
  39. String first;
  40. String last;
  41.  
  42. Name({this.title, this.first, this.last});
  43.  
  44. Name.fromJson(Map<String, dynamic> json) {
  45. title = json['title'];
  46. first = json['first'];
  47. last = json['last'];
  48. }
  49. }
  50.  
  51. class Location {
  52. Street street;
  53. Location(
  54. {this.street});
  55.  
  56. Location.fromJson(Map<String, dynamic> json) {
  57. street =
  58. json['street'] != null ? new Street.fromJson(json['street']) : null;
  59. }
  60. }
  61.  
  62. class Street {
  63. int number;
  64. String name;
  65.  
  66. Street({this.number, this.name});
  67.  
  68. Street.fromJson(Map<String, dynamic> json) {
  69. number = json['number'];
  70. name = json['name'];
  71. }
  72.  
  73. Map<String, dynamic> toJson() {
  74. final Map<String, dynamic> data = new Map<String, dynamic>();
  75. data['number'] = this.number;
  76. data['name'] = this.name;
  77. return data;
  78. }
  79. }
  80.  
  81. class Picture {
  82. String large;
  83. String medium;
  84. String thumbnail;
  85.  
  86. Picture({this.large, this.medium, this.thumbnail});
  87.  
  88. Picture.fromJson(Map<String, dynamic> json) {
  89. large = json['large'];
  90. medium = json['medium'];
  91. thumbnail = json['thumbnail'];
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement