Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About entity issues #53

Open
Jay-57blocks opened this issue May 9, 2023 · 0 comments
Open

About entity issues #53

Jay-57blocks opened this issue May 9, 2023 · 0 comments

Comments

@Jay-57blocks
Copy link

I read your article
Entity: The business objects of the application, they are the least likely to change when external things change
Model: Inherit and extend Domain layer Entity, realize json conversion and more needs

Generally speaking, business requirements have some additional fields, such as isSelected and isComplete, which are related to UI state
I don't know whether these attributes are placed in the Domain layer or in the Presentation layer to create a new model

I am very confused and hope to wait for your reply

Thanks

Domain:

class QuestionEntitie {
  final int id;
  final String category;
  final String question;

 /// Should it be declared here?
  final bool isSelected;
  final bool isComplete;
}

OR Presentation:

class QuestionItem {
  final QuestionEntitie item
  /// or declare here ?
  final bool isSelected;
  final bool isComplete;
}

Data:

class QuestionModel extends QuestionEntitie {
  QuestionModel({
    required super.id,
    required super.category,
    required super.question,
  });

  factory QuestionModel.fromJson(Map<String, dynamic> json) {
    return QuestionModel(
      id: json['id'],
      category: json['category'],
      question: json['question'],
    );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant