infrastructure/models/moviedb/ directory contains two classes that mirror the JSON structure returned by TheMovieDB REST API. They are used only inside the datasource layer; the rest of the app works exclusively with the domain Movie entity.
Class hierarchy
MovieDbResponse
Represents the full JSON object returned by paginated endpoints such as /movie/now_playing, /movie/popular, /movie/upcoming, /movie/top_rated, and the region-filtered discover endpoint.
moviedb_response.dart
Fields
Dates?
Optional screening window. Only present on the
/movie/now_playing endpoint. null for popular, upcoming, top-rated, and discover responses.int
required
Current page number returned by the API.
List<MovieMovieDB>
required
List of movie entries for the current page. Each entry is deserialized as a
MovieMovieDB object.int
required
Total number of pages available for the query. Mapped from
total_pages in the JSON.int
required
Total number of movies matching the query across all pages. Mapped from
total_results in the JSON.Dates
Represents the theatrical screening window included in now-playing responses.
moviedb_response.dart
Fields
DateTime
required
Latest date in the now-playing window. Parsed from an ISO 8601 date string (
"YYYY-MM-DD").DateTime
required
Earliest date in the now-playing window. Parsed from an ISO 8601 date string (
"YYYY-MM-DD").MovieMovieDB
Mirrors the shape of a single movie object inside the results array. Field names in fromJson match the snake_case keys used by TheMovieDB API.
movie_moviedb.dart
Fields
bool
required
Whether the movie has an adult content rating. Defaults to
false when absent from the JSON.String
required
Raw path segment for the backdrop image (e.g.
"/abc123.jpg"). Empty string when not provided. The mapper prepends the TMDB image base URL.List<int>
required
Array of genre IDs from the
genre_ids JSON key.int
required
Unique TheMovieDB movie identifier.
String
required
ISO 639-1 language code. Mapped from
original_language.String
required
Title in the original language. Mapped from
original_title.String
required
Plot summary. Defaults to an empty string when the API omits this field.
double
required
TheMovieDB popularity metric, coerced to
double with ?.toDouble().String
required
Raw path segment for the poster image (e.g.
"/xyz456.jpg"). Empty string when not provided. Mapped from poster_path.DateTime
required
Parsed from the
release_date string. Falls back to DateTime(1900) when the field is null, empty, or unparseable. Mapped from release_date.String
required
Localised display title.
bool
required
true for video releases.double
required
Average rating, coerced to
double. Mapped from vote_average.int
required
Total vote count. Mapped from
vote_count.MovieMapper
MovieMapper.movieDBToEntity() is the single function that converts a MovieMovieDB infrastructure model into a domain Movie entity. It lives in lib/infrastructure/mappers/movie_mapper.dart.
movie_mapper.dart
Transformations applied
The image base URL uses HTTP, not HTTPS. If your environment or device policy requires HTTPS, update the base URL constant in
MovieMapper and adjust any network security configuration accordingly.