Skip to content

Instantly share code, notes, and snippets.

@xsahil03x
Last active March 25, 2020 07:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xsahil03x/48fbfab22167be072f1fc3bdd102a59f to your computer and use it in GitHub Desktop.
Save xsahil03x/48fbfab22167be072f1fc3bdd102a59f to your computer and use it in GitHub Desktop.
class MovieResponse {
int totalResults;
List<Movie> results;
MovieResponse.fromJson(Map<String, dynamic> json) {
totalResults = json['total_results'];
if (json['results'] != null) {
results = new List<Movie>();
json['results'].forEach((v) {
results.add(new Movie.fromJson(v));
});
}
}
}
class Movie {
int id;
var voteAverage;
String title;
String posterPath;
String overview;
String releaseDate;
Movie.fromJson(Map<String, dynamic> json) {
id = json['id'];
voteAverage = json['vote_average'];
title = json['title'];
posterPath = json['poster_path'];
overview = json['overview'];
releaseDate = json['release_date'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment