This application was created using Clean Architecture and Cubit for state management. This simple app consumes data from the Faker Api REST API to display randomly generated (fake) books. The presented interface is minimal as efforts were concentrated on creating a flexible and scalable architecture and directory structure.
This project was based on the repository by @deus-magna.
This application was built with Flutter version 2.2.3
and Dart version 2.13.4
.
Step 1:
Download or clone this repository with the following command:
git clone https://github.com/baguilar6174/flutter-books-app.git
Step 2:
At the project root, run the following command in the console to get the necessary dependencies:
flutter pub get
- The app follows Clean Architecture principles.
- Consumes a REST API.
- Displays information through a minimal interface.
- Adaptable to desktop, tablet, and mobile devices.
- Built using the Cubit state management system.
equatable: ^2.0.3
: Allows deep object comparison (testing-friendly).dartz: ^0.10.0-nullsafety.2
: Provides functionality for sending a model and an exception within the same encapsulation, enabling error control and handling.http: ^0.13.3
: Enables HTTP requests.bloc: ^7.0.0
: State management with Cubit.flutter_bloc: ^7.0.1
: State management with Cubit.responsive_builder: ^0.4.1
: Facilitates responsive UI control.get_it: ^7.2.0
: Dependency injection management.
Project Architecture
The project is divided into three main layers: data
, domain
, and ui
.
- The
ui
layer contains everything related to the user interface. This layer handles state management to control actions like animations, button transitions, etc. - The
domain
layer handles use cases, which can be considered tasks, features, or user stories. Here you will find data entities or models that facilitate data usage and transfer. - The
data
layer implements therepository
pattern, serving as a data manager to control the reception of information from various sources. These data sources, calleddatasources
, retrieve information from different sources (local or remote).
It is important to note that both the data and presentation layers are coupled to the domain layer. This makes it easier to change the data source or graphical interface, as long as the domain remains unchanged.
├── android/
├── ios/
├── lib/
├── app/
│ ├── core/
│ │ ├── errors/
│ │ │ ├── exceptions.dart
│ │ │ ├── failure.dart
│ │ ├── theme/
│ │ │ ├── colors.dart
│ ├── data/
│ │ ├── repositories_impl/
│ │ ├── models/
│ │ ├── datasources/
│ │ │ ├── local/
│ │ │ ├── network/
│ ├── device/
│ ├── dependency_injection/
│ ├── domain/
│ │ ├── entities/
│ │ ├── repositories/
│ │ ├── services/
│ │ ├── usecases/
│ ├── ui/
│ │ ├── pages/
│ │ │ ├── page1/
│ │ │ │ ├── widgets/
│ │ │ │ ├── page1_page.dart
...
│ │ ├── widgets/
│ │ ├── routes/
│ │ │ ├── app_routes.dart
│ │ │ ├── routes.dart
│ └── my_app.dart
└── main.dart
...
└── pubspec.yaml
Main Screen |
- Website - www.bryan-aguilar.com
- Medium - baguilar6174
- LinkedIn - baguilar6174