Movie.fromJson constructor

Movie.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Movie.fromJson(Map<String, dynamic> json) {
  return Movie(
    title: json['title'],
    posterPath: 'https://image.tmdb.org/t/p/original${json['poster_path']}',
    overview: json['overview'],
    releaseDate: DateTime.parse(json['release_date']),
    language: json['original_language'],
    voteAverage: json['vote_average'],
    backdropPath: 'https://image.tmdb.org/t/p/original${json['backdrop_path']}',
    id: json['id'],
    originalTitle: json['original_title'],
    adult: json['adult'],
    genreIds: List<int>.from(json['genre_ids']),
    popularity: json['popularity'],
    video: json['video'],
    voteCount: json['vote_count'],
    runtime: json.containsKey('runtime') ? json['runtime'] : 0,
  );
}