Flutter TDD Clean Architecture Course  – Data Layer Overview & Models
📗 Learn from the written tutorial 👇👇
👨💻 Do you write good code? Find out now!
While the domain layer is the safe center of an app which is independent of other layers, the data layer is a place where the app meets with the harsh outside world of APIs and 3rd party libraries. It consists of low-level Data Sources, Repositories which are the single source of truth for the data, and finally Models.
You may have noticed that we always start working from the inner parts of the app and work our way to the outskirts. After all, we started with the completely independent domain and even there we first created the Entity. Now, we'll start with the Model and only then go ahead and implement the Repository and the low-level Data Sources.
Therefore, it makes sense to start at the center, since otherwise, we'd have a hard time implementing the Use Cases, for example, if we didn't have any Entities which can be returned first.
All of this is possible only through the power of contracts, which in the case of Dart are implemented as abstract classes. Think about it, we've fully implemented the domain layer using TDD and yet, all that the Use Cases depend on is just an abstract NumberTriviaRepository class which we've mocked with fake implementation all along...
Go to my website for more information, code examples, and articles:
Follow me on social media: