Documentation Index
Fetch the complete documentation index at: https://mintlify.com/juuaaann456/DMI-Practica06/llms.txt
Use this file to discover all available pages before exploring further.
movieRepositoryProvider is a Riverpod Provider that constructs the single shared instance of MovieRepositoryImpl for the entire widget tree. All movie-list providers depend on it to reach the TheMovieDB API.
Provider definition
movies_repository_provider.dart
Return type
movieRepositoryProvider is inferred as Provider<MovieRepositoryImpl>. Because MovieRepositoryImpl implements the abstract MoviesRepository contract, consumers only need to depend on the interface.
Dependency injection pattern
The provider uses constructor injection:MovieRepositoryImpl receives a MoviedbDataSource instance through its constructor. This creates a strict, one-directional dependency chain:
MoviedbDataSource directly. They interact only through the MoviesRepository abstract interface, which makes it straightforward to swap the data source (e.g. a mock or a local cache) without touching any presentation code.
MovieRepositoryImpl
MovieRepositoryImpl implements every method declared in the MoviesRepository abstract class by delegating to the injected MoviesDatasource.
movie_repository_impl.dart
MoviesRepository abstract interface
The domain layer defines the contract that any repository implementation must fulfil. This keeps the presentation and domain layers free of infrastructure details.
movies_repository.dart
Reading the provider
Movie-list providers watchmovieRepositoryProvider and pull individual method references from it:
movies_providers.dart
Use
ref.read (not ref.watch) when calling the repository imperatively inside callbacks or initState. Reserve ref.watch for reactive rebuilds.