This e-commerce application is built using Flutter with BLoC (Business Logic Component) and clean architecture. It fetches product data from Fake Store API and displays it in a grid format. The app also includes local storage using SQLite.
- Fetch product data from a remote API
- Display products in a grid format
- Local storage using SQLite
- Clean architecture with BLoC for state management
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/shamimcse1/clean_architecture_using_bloc.git cd clean_architecture_using_bloc -
Install dependencies:
flutter pub get
- Run the app:
flutter run
Once the app is running, it will display a grid of products fetched from the Fake Store API. You can scroll through the products and see details such as the product image, title, and price.
The project follows a clean architecture structure with separation of concerns. Below is an overview of the project structure:
lib/ ├── data/ │ ├── datasource/ │ │ ├── local/ │ │ │ └── product_local_data_source.dart │ │ └── remote/ │ │ └── product_remote_data_source.dart │ ├── models/ │ │ └── product_model.dart │ └── repositories/ │ └── product_repository_impl.dart ├── domain/ │ ├── entities/ │ │ └── product.dart │ ├── repositories/ │ │ └── product_repository.dart │ └── usecases/ │ └── get_products.dart ├── di/ │ ├── injection_container │ ├── presentation/ │ ├── bloc/ │ │ └── product_bloc.dart │ ├── pages/ │ │ └── product_page.dart │ └── widgets/ │ └── product_grid.dart ├── main.dart └── injection_container.dart
- datasource: Contains remote and local data sources.
- local: Implements local storage using SQLite.
- remote: Fetches data from the Fake Store API.
- models: Contains data models.
- repositories: Implements repository pattern.
- entities: Contains core entities.
- repositories: Defines repository interfaces.
- usecases: Contains use cases for the application.
- injection_container.dart
- bloc: Contains BLoC for state management.
- pages: Contains UI pages.
- widgets: Contains reusable UI components.
- main.dart
- Entry point of the application.
- Configures dependency injection using GetIt.
- Flutter
- flutter_bloc
- http
- sqflite
- path_provider
- provider
- get_it