Created
December 14, 2019 14:54
-
-
Save rrifafauzikomara/c77ed85da52beaa9bb633db2a1140e67 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Movie { | |
int page; | |
int totalResults; | |
int totalPages; | |
List<Results> results; | |
Movie({this.page, this.totalResults, this.totalPages, this.results}); | |
Movie.fromJson(Map<String, dynamic> json) { | |
page = json['page']; | |
totalResults = json['total_results']; | |
totalPages = json['total_pages']; | |
if (json['results'] != null) { | |
results = new List<Results>(); | |
json['results'].forEach((v) { | |
results.add(new Results.fromJson(v)); | |
}); | |
} | |
} | |
Map<String, dynamic> toJson() { | |
final Map<String, dynamic> data = new Map<String, dynamic>(); | |
data['page'] = this.page; | |
data['total_results'] = this.totalResults; | |
data['total_pages'] = this.totalPages; | |
if (this.results != null) { | |
data['results'] = this.results.map((v) => v.toJson()).toList(); | |
} | |
return data; | |
} | |
} | |
class Results { | |
double popularity; | |
int voteCount; | |
bool video; | |
String posterPath; | |
int id; | |
bool adult; | |
String backdropPath; | |
String originalLanguage; | |
String originalTitle; | |
List<int> genreIds; | |
String title; | |
String voteAverage; | |
String overview; | |
String releaseDate; | |
Results( | |
{this.popularity, | |
this.voteCount, | |
this.video, | |
this.posterPath, | |
this.id, | |
this.adult, | |
this.backdropPath, | |
this.originalLanguage, | |
this.originalTitle, | |
this.genreIds, | |
this.title, | |
this.voteAverage, | |
this.overview, | |
this.releaseDate}); | |
Results.fromJson(Map<String, dynamic> json) { | |
popularity = json['popularity']; | |
voteCount = json['vote_count']; | |
video = json['video']; | |
posterPath = json['poster_path']; | |
id = json['id']; | |
adult = json['adult']; | |
backdropPath = json['backdrop_path']; | |
originalLanguage = json['original_language']; | |
originalTitle = json['original_title']; | |
genreIds = json['genre_ids'].cast<int>(); | |
title = json['title']; | |
voteAverage = json['vote_average'].toString(); | |
overview = json['overview']; | |
releaseDate = json['release_date']; | |
} | |
Map<String, dynamic> toJson() { | |
final Map<String, dynamic> data = new Map<String, dynamic>(); | |
data['popularity'] = this.popularity; | |
data['vote_count'] = this.voteCount; | |
data['video'] = this.video; | |
data['poster_path'] = this.posterPath; | |
data['id'] = this.id; | |
data['adult'] = this.adult; | |
data['backdrop_path'] = this.backdropPath; | |
data['original_language'] = this.originalLanguage; | |
data['original_title'] = this.originalTitle; | |
data['genre_ids'] = this.genreIds; | |
data['title'] = this.title; | |
data['vote_average'] = this.voteAverage; | |
data['overview'] = this.overview; | |
data['release_date'] = this.releaseDate; | |
return data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment