A Flutter project presenting NASA Picture of the Day for a randomly chosen day.
This application is based on NASA Open APIs. To use it, generate your API KEY which could be then used in the app.
This project uses several plugins to generate code, such as json_serializable, freezed, retrofit_generator, and injectable_generator. To generate these files, run:
flutter packages pub run build_runner build --delete-conflicting-outputs
or to rebuild generated files continuously during development:
flutter packages pub run build_runner watch --delete-conflicting-outputs
Localization is generated in Visual Studio Code, with the help of Flutter Intl extension. Thanks to it, there is no need to run
flutter gen-l10n
after every change in arb
files.
The application shows a preview of an interpretation of Uncle Bob's Clean Architecture.
It consists of several layers:
- Domain layer
The domain layer is the inner layer containing the app's business logic and abstractions. - Application layer
The application layer holds state management logic, in this example based on BLoC. The logic here is only connected with the presentation layer and users' interactions, with no data-related computations. Mostly just state managers distributing tasks toUseCase
from the domain layer. - Data layer
This layer implements repositories from the domain layer. Errors and exceptions are handled there. In addition, there is an implementation of data sources, such as Rest APIs or local DBs. There are also JSON parsers and models, which are further converted by mappers to entities. - Presentation layer
All pages, widgets, and navigation are kept in the presentation layer. It is the “dumbest” layer, containing only the UI (even without form validation which is handled in the ppplication layer). Depends completely on the Flutter framework.
The project structure is feature-based, meaning that each feature contains the whole architecture inside its folder. If there are any components or logic that are used throughout the app, there's a `core` folder holding these reusable code pieces.