Skip to main content
Cinemapedia displays movies in five distinct categories, each backed by a dedicated Riverpod provider and a separate TheMovieDB API endpoint. All categories share the same MoviesNotifier class and support infinite scroll pagination.

Categories overview

En cines

Movies currently playing in theaters. Uses the /movie/now_playing endpoint. Provider: nowPlayingMoviesProvider.

Próximamente

Upcoming releases. Uses the /movie/upcoming endpoint. Provider: upcomingMoviesProvider.

Populares

Most popular movies right now. Uses the /movie/popular endpoint. Provider: popularMoviesProvider.

Mejor valoradas

Highest rated movies of all time. Uses the /movie/top_rated endpoint. Provider: topratedMoviesProvider.

Cine Mexicano

Mexican cinema, sorted by rating. Uses the /discover/movie endpoint with region=MX and with_origin_country=MX. Provider: mexicanMoviesProvider.

Category reference table

API datasource

All HTTP requests are made by MoviedbDataSource using the dio package. The base URL is https://api.themoviedb.org/3 with language=es-MX applied globally.

Standard categories

For Now Playing, Popular, Upcoming, and Top Rated, the pattern is identical — only the path differs:
Movies without a poster image are filtered out before the list is returned. This prevents broken image widgets in the UI.

Mexican Cinema

The getMexicanMovies method uses the /discover/movie endpoint with additional query parameters:

Providers

Each category has its own NotifierProvider<MoviesNotifier, List<Movie>>. All five providers are defined in movies_providers.dart and follow the same pattern:
Each provider receives a builder function that returns the appropriate repository method. This makes MoviesNotifier reusable across all five categories.

Infinite pagination

Pagination is handled entirely by MoviesNotifier. Calling loadNextPage() increments an internal page counter and appends the new results to the existing state list.
The isLoading guard prevents duplicate requests if loadNextPage() is called again before the previous one completes — for example, when the user rapidly scrolls to the end of a list.

Scroll-triggered loading

MovieHorizontalListview attaches a ScrollController listener that calls loadNextPage() when the scroll position is within 200 pixels of the end of the list:
This callback is wired up in HomeScreen for each category: