There are lots of information on how to connect an entity in the domain layer to a model in the data layer.
In Dart, the model usually extends the entity. All the tutorials I saw, only have plain, easy entities.
But for a single nested entity there is nothing.
Just an example:
An entity Address
.
class Address {
String city;
Address(this.city)
}
An Entity User
:
class User{
String name;
Address addr;
User(this.city, this.address)
}
How will the data models look like in the data layer? And how are they connected?
How and where would you implement a copyWith method of the User? Needs to be called in a UseCase. I read that one should map the Address-Entity to a Adress-Model.
But if that is needed for such a single data model, how would this look like if you have several data models and even more nested?
Also, I read that clean architecture make sense in big projects. But then it becomes even worse.
So, is there any good, smart solution? Is it really worth separating models and entities?
Is clean architecture a theory? Only applicable to small toy apps? Does clean architecture solve non-existent problems? In the past in C# most of the time you would have services, models, viewmodels and views (and of course nested in features).
I would like to adopt clean architecture, but it seems that it causes more problems than solving real world problems.
Maybe I saw wrong implementations of clean architecture. The idea of separation between data. business logic, and views is a very good one – but not new at all.