Entity đại diện cho khái niệm domain (đối tượng nghiệp vụ cốt lõi): User(id, name, email).
- Entity là class Dart thuần, không phụ thuộc framework và dễ test, nằm ở domain layer.
- Model là biểu diễn API/database với serialization:
UserModel.toJson(). - Model nằm ở data layer.
- Dùng entity trong business logic, model trong API/DB, và mapper function để chuyển đổi giữa chúng.
Entity represents a domain concept — a pure Dart class in the domain layer, framework-agnostic and testable.
- Model is an API/database representation with serialization in the data layer.
- Use entities in business logic, models in API/DB, and mapper functions to convert between them.