toJson method

Map<String, dynamic> toJson()
override

Implementation

Map<String, dynamic> toJson() {
  var map = super.toJson();

  map['certification_country'] = certificationCountry;
  map['certification'] = certification;
  map['certification.lte'] = certificationLTE;
  map['include_video'] = includeVideo?.toString();
  map['primary_release_date.gte'] = primaryReleaseDateGTE?.toString();
  map['primary_release_date.lte'] = primaryReleaseDateLTE?.toString();
  map['release_date.gte'] = releaseDateGTE?.toString();
  map['release_date.lte'] = releaseDateLTE?.toString();
  map['sort_by'] = sortBy?.toString();
  map['vote_count.gte'] = voteCountGTE?.toString();
  map['vote_count.lte'] = voteCountLTE?.toString();
  map['vote_average.gte'] = voteAverageGTE?.clamp(0, 10).toString();
  map['vote_average.lte'] = voteAverageLTE?.clamp(0, 10).toString();
  map['with_cast'] = withCast?.toString();
  map['with_crew'] = withCrew?.toString();
  map['with_companies'] = withCompanies?.join(',');
  map['with_genres'] = withGenres?.join(',');
  map['with_keywords'] = withKeywords?.join(',');
  map['with_people'] = withPeople?.join(',');

  map.removeWhere((_, value) => value == null);

  return map;
}