Flutter TDD Clean Architecture Course [4] – Data Layer Overview & Models

Reso Coder
Reso Coder
47.4 هزار بار بازدید - 5 سال پیش - 📗 Learn from the written
📗 Learn from the written tutorial 👇👇
https://resocoder.com/flutter-tdd-cle...

👨‍💻 Do you write good code? Find out now!
https://resocoder.com/good-code-quiz

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:
https://resocoder.com

Follow me on social media:
Instagram: resocoder
Facebook: resocoder
Twitter: resocoder
5 سال پیش در تاریخ 1398/06/18 منتشر شده است.
47,424 بـار بازدید شده
... بیشتر