Error Handling
Priority: P1 (HIGH)
Standardized functional error handling using dartz and freezed failures.
Implementation Guidelines
- Either Pattern: Return
Either<Failure, T>from repositories. No exceptions in UI/BLoC. - Failures: Define domain-specific failures using
@freezedunions. - Mapping: Infrastructure catches
Exceptionand returnsLeft(Failure). - Consumption: Use
.fold(failure, success)in BLoC to emit corresponding states. - Typed Errors: Use
left(Failure())andright(Value())fromDartz.
Reference & Examples
For Failure definitions and API error mapping: See references/REFERENCE.md.
Related Topics
layer-based-clean-architecture | bloc-state-management