Simple News App – Flutter Clean Architecture with BLOC, Freezed, Get_It Package
This repository contains a simple news app built using Flutter, following the Clean Architecture principles and utilizing BLOC pattern along with Freezed and Get_It packages.
The Simple News App is a mobile application that displays news articles fetched from an API. It demonstrates the implementation of Clean Architecture in Flutter, separating the app into layers with clear responsibilities. The architecture allows for easy testing, maintenance, and scalability.
The app uses the BLOC (Business Logic Component) pattern to manage the state of the application. BLOC separates the business logic from the UI, making the code more modular and testable. It also utilizes the Freezed package to generate immutable classes for state management and data models. The Get_It package is used for dependency injection, making it easier to manage dependencies between different layers of the app.
- Display a list of news articles fetched from an API.
- Cached Thumbnail with Fallback and Loading Placeholder
Clone the repository:
git clone https://github.com/mimamch/news_app_clean_architecture
Change to the project directory:
Install the dependencies:
flutter pub get
Run the app:
The app follows the Clean Architecture principles, with the following structure:
core/: Contains Core Utilities that used entire application
app: Initializes the app and sets up the dependency injection.
data/: Contains the data layer responsible for handling data fetching and caching.
domain/: Defines the core business logic and entities of the app.
presentation/: Contains the UI layer of the app, including BLOCs, views, and widgets.
main.dart: Entry point of the application.
The app utilizes several Flutter packages:
- flutter_bloc: Implements the BLOC pattern for state management.
- freezed: Generates immutable classes for state management and data models.
- json_annotation: Provides annotations for JSON serialization.
- json_serializable: Generates code for JSON serialization based on annotations.
- get_it: Provides dependency injection capabilities.
- dio: Handles HTTP requests to fetch news articles.
- equatable: Simplifies equality comparisons for state management.
For a complete list of dependencies, please refer to the
Contributions to the Simple News App are welcome! If you find any bugs or would like to suggest improvements, please open an issue or submit a pull request.
When contributing, please follow the existing code style and ensure that all tests pass before submitting any changes. Additionally, make sure to update the documentation if necessary.
This project is licensed under the MIT License. Feel free to use and modify the code according to your needs.