Products App is a Flutter e-commerce application that allows users to view products and view detailed information. It follows Clean Architecture, uses ChangeNotifier for state management, and handles API requests with Dio.
- Displays a list of available products with a clean UI.
- Supports pull-to-refresh with
RefreshIndicator. - Uses
ChangeNotifierandValueListenableBuilderfor state management.
- Shows product images, description, price, and category.
- Includes shipping information, warranty, dimensions, and return policy.
- Displays customer reviews in a structured format.
- Uses a responsive UI with
SliverAppBar.
- Implemented with
go_routerfor efficient route management. - Navigates to ProductDetailsPage when selecting a product.
- Uses
blocsandcubitsfor real-time UI updates. - Loading indicators (
CircularProgressIndicator) when fetching data. - Shows error messages with retry options in case of failure.
The app is built using the following technologies:
- Flutter - Main framework
- Dart - Programming language
- go_router - Navigation
- Dio - HTTP client for API requests
- get_it - Singleton creation and dependency injection
- Mockito - Unit testing with mocks
- fpdart - Functional programming utilities (
Either<Failure, Success>) - network_image_mock - Image widget testing
All tests passed successfully with a total of 24 tests executed across different application components. TOTAL: 24/24 tests passed
| Class | Tests Passed | Method | Description |
|---|---|---|---|
| DioHttpClientImpl | 2/2 | getRequest<ProductsModel> | ✅ should perform a GET request and return a Product model ✅ should handle errors when performing a GET request |
| Class | Tests Passed | Method | Description |
|---|---|---|---|
| ProductsDatasourceImpl | 6/6 | getProducts | ✅ Should perform a GET request and return a products model ✅ Should handle errors when performing a GET request |
| getCategories | ✅ Should perform a GET request and return a CategoriesModel ✅ Should handle errors when performing a GET request |
||
| getProductsByCategory | ✅ Should perform a GET request and return a products model ✅ Should handle errors when performing a GET request |
| Class | Tests Passed | Method | Description |
|---|---|---|---|
| ProductsRepositoryImpl | 6/6 | getProducts | ✅ Should return Right<Failure, Products> ✅ Should return Left<Failure, Products> when an exception occurs |
| getCategories | ✅ Should return Right<Failure, Categories> ✅ Should return Left<Failure, Categories> when an exception occurs |
||
| getProductsByCategory | ✅ Should return Right<Failure, Products> ✅ Should return Left<Failure, Products> when an exception occurs |
| Use Case | Tests Passed | Description |
|---|---|---|
| GetCategoriesUseCase | 2/2 | ✅ Should return Right<Failure, Categories> when calling successfully ✅ Should return Left<Failure, Products> when an exception occurs |
| GetProductsByCategoryUseCase | 2/2 | ✅ Should return Right<Failure, Products> when calling successfully ✅ Should return Left<Failure, Products> when an exception occurs |
| GetProductsUseCase | 2/2 | ✅ Should return Right<Failure, Products> when calling successfully ✅ Should return Left<Failure, Products> when an exception occurs |
| Cubit | Tests Passed | Method | Description |
|---|---|---|---|
| ProductsPageCubit | 4/4 | getProducts | ✅ Should load a Products entity and set ProductPageStatus.loaded ✅ Should return a failure when an exception occurs and set ProductPageStatus.error |
| getCategories | ✅ Should load a Categories entity and set CategoriesListStatus.loaded ✅ Should return a failure when an exception occurs and set CategoriesListStatus.error |
Ensure you have the following installed on your system:
- Flutter SDK (latest stable version)
- Dart SDK (included with Flutter)
- Android Studio / VS Code (for development)
- Xcode (if running on iOS)
- An Android Emulator or a physical device connected via USB
1️⃣ Clone the repository
git clone https://github.com/matias-casco/products_app.git
cd products_app2️⃣ Install dependencies
flutter pub get3️⃣ Run the application on an emulator or device
flutter run4️⃣ Run tests
flutter test