toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  return {
    'page': page,
    'language': language,
    if (primaryReleaseDateGte != null) 'primaryReleaseDateGte': primaryReleaseDateGte?.toIso8601String(),
    if (primaryReleaseDateLte != null) 'primaryReleaseDateLte': primaryReleaseDateLte?.toIso8601String(),
    if (withGenres != null) 'withGenres': withGenres,
    if (withCast != null) 'withCast': withCast,
    if (persons != null)
      'persons': persons
          ?.map((person) => {
                'adult': person.adult,
                'gender': person.gender,
                'id': person.id,
                'known_for_department': person.knownForDepartment,
                'name': person.name,
                'original_name': person.originalName,
                'popularity': person.popularity,
                'profile_path': person.profilePath,
              })
          .toList(),
  };
}