A Flutter Weather App, developed with Bloc, Clean Architecture Get_it and TDD(Test Driven Development).
- UI and Project flow - Real-time Weather App Using Vanilla JavaScript and API
In order for the Sunshine app to function properly as of October 18th, 2015 an API key for openweathermap.org must be included with the build.
We recommend that each student obtain a key via the following instructions, and include the unique key for the build by adding the following line to [USER_HOME]/.gradle/gradle.properties
apiKey="<UNIQUE_API_KEY">
in lib/core/constants.dart file
Models are subclasses of the entities and handle data serialization. They transform data between entities and data sources. Models help to achieve the OCP(Open-Close_principle) principle
Repositories have the implementation of the repository contract defined in the domain layer. They interact with data sources to retrieve data. Repository implementations allow switching data sources without modifying the domain layer.
Data sources provide the actual data from external sources(eg. APIs, databases). They implement the repository interface defined int the domain layer. Data sources promote modularity and adhere to the DIP principle.
Entities represent the core data models of the application. They define the structure and properties of the data. Create an entity to be passed around in the application.
Repositories define the contract between the data layer and domain layer. Create a repository to specify the methods for data operations. They handle data operations and follow the DIP principle.
Usecases represent the business logic of the applications. They depend on the repository and call its methods to perform data operate. Usecases enforce the SRP principle and focus on specific functionalities.
Bloc/Cubit manages the state of the UI and business logic. It depends on usecases to execute business operations. Bloc/Cubit emits states to the UI, decoupling it from business logic.
Views are responsible for displaying UI components and listening to bloc/cubit states. They react to state changes and update the UI accordingly. Views promote the SRP principle by separating presentation logic from business logic.
TDD involves writing test before implementing the actual code. Each layer and module can be tested independently. TDD helps in achieving better code quality and fewer bugs.
Dependency injection is used to provide dependencies to different layer of the app. It help in managing the dependencies and allows easy swapping of implementations. For example. GetIt can be used for dependency injection.