技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
flutter-error-handling【数据与研究】Implement functional repository error recovery with Either/Failure patterns in Flutter. Use when handling exceptions or dartz Either types in data flows; defer UI-only retry buttons.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
@freezed unions (e.g., UnauthorizedFailure, OutOfStockFailure).Either<Failure, T>. No exceptions in UI/BLoC.DioException) and returns Left(Failure). Never rethrow to UI..fold(failure, success) in BLoC to emit corresponding states. Remove try/catch from BLoC.failure.failureMessage (returns TRObject or localized string) for UI-safe text.catch blocks MUST route errors via AppLogger.error(AppException.fromException(e).message, error: e, stackTrace: st) for observability and type-safe UI messages.See implementation examples for repository error mapping and BLoC consumption patterns.
For Failure definitions and API error mapping: See references/REFERENCE.md.
Either and folds; try/catch belongs in Infrastructure@freezed Failure subclasses instead of Left('Something went wrong')Left(Failure) instead of throwing ExceptionAppLogger.error in BLoC/UI catch to ensure Crashlytics tracking and type-safe UI messageslayer-based-clean-architecture | bloc-state-management
When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant: