User Entity
domain/entities
Overview
Pure Dart model that represents an authenticated user inside the domain layer. It carries the minimum identity payload the rest of the app needs after login — id, email, display name and a few profile flags — with no Flutter or HTTP imports.
User Flow
- Built by data-source mappers from the raw JSON payload (UserModel.toEntity).
- Returned wrapped in Either<AuthFailure, User> through the repository.
- Flows up to the use cases, then to AuthController which exposes it as Rx<User?>.
- UI screens read it reactively to render the avatar, greetings and gated routes.
Cases & Edge Cases
- Email is normalized to lowercase before construction so equality checks are stable.
- displayName falls back to the part before '@' when the backend omits it.
- Treat the entity as immutable — copyWith for any mutation, never setters.
Code References
- lib/features/auth/domain/entities/user.dart
- lib/features/auth/data/models/user_model.dart:42 // toEntity()
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
Keep the entity framework-agnostic. UserModel (data layer) is the JSON-aware sibling — it adapts wire format to this entity.