Reputation: 13
which part of file structure we should do processes of fromJson and toJson? Is it business or data layer?
I created entity class on business layer and an entity model created on data layer which extends entity.
I tried to building clean architecture on my project and watching some tutorials and reading blogs but I'm confused.
I hope I explain my question clearly.
Regards
Upvotes: 1
Views: 137
Reputation: 567
For the purpose of clean architecture, the fromJson
and toJson
methods should typically be implemented in the data layer. Let's take a look on it.
Business Layer (Domain Layer):
Data Layer (Repository Layer):
fromJson
and toJson
.You can follow the architecture as:
/lib
/data
- entity_model.dart
- repository.dart
/domain
- entity.dart
- use_case.dart
/presentation
- screen.dart
Upvotes: 1