I'm trying to learn how to follow a clean feature-first architecture using Bloc and Freezed.
From what I've seen, I should have inside the Domain layer, an entity class declaring only its properties for the presentation layer to use, and in the Data layer, I should have a DTO of this class that's responsible for implementing the FromJson methods and whatever I might need when getting the data from the dataSources and parse it to an entity.
My questions are:
1- To which of these classes (if not both) do I create the freezed code?
2-How do I connect the entity and the model when using the repository, should I create "fromEntity, toEntity" methods or something alike? And if such methods were to be required, can I create them with Freezed?
I'm working with this entity class:
class NoteEntity{
final String title;
final String description;
NoteEntity({required this.title, required this.description});
}
I was using it with freezed like this:
@freezed
class NoteEntity with _$NoteEntity {
const factory NoteEntity({
required String title,
required String description,
}) = _NoteEntity;
}