> flutter-error-handling
Functional error handling using Dartz and Either. Use when implementing functional error handling, Either monad, or failure types in Flutter. (triggers: lib/domain/**, lib/infrastructure/**, Either, fold, Left, Right, Failure, dartz)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/flutter-error-handling?format=md"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. - Low-Cardinality Logging: Use stable message templates; pass variable data via metadata/context.
- Layer Restriction:
try/catchonly in Infrastructure. UI/Application should not catch. - Failure Mapping: Convert external exceptions with
FailureHandler.handleFailure(e). - Localization: Use
failure.failureMessage(returnsTRObject) for UI-safe text. - Right/Left Restriction: Only Infrastructure may construct
Right()/Left(). - No Silent Catch: Never swallow errors without logging or a documented retry.
Reference & Examples
For Failure definitions and API error mapping: See references/REFERENCE.md.
Related Topics
layer-based-clean-architecture | bloc-state-management
🚫 Anti-Patterns
- Do NOT use standard patterns if specific project rules exist.
- Do NOT ignore error handling or edge cases.
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)