feat: Phase 1 foundation - core infrastructure and navigation
Clean Architecture structure: - core/config - Environment configuration - core/theme - Material 3 theming with FlexColorScheme - core/error - Typed exception hierarchy - core/api - Dio HTTP clients with interceptors - core/auth - Authentication state management - routing - go_router with shell navigation - shared/layouts - Adaptive scaffold Dependencies added: - flutter_riverpod, riverpod_annotation, riverpod_generator - freezed, freezed_annotation, json_serializable - dio, go_router, shared_preferences - flex_color_scheme, flutter_adaptive_scaffold Features: - Responsive navigation (rail on desktop, bottom on mobile) - Dashboard placeholder with welcome card - Theme switching infrastructure - API client ready for Core API and Tatlock API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/// Base exception for all application errors.
|
||||
sealed class AppException implements Exception {
|
||||
const AppException({required this.message, this.cause});
|
||||
|
||||
final String message;
|
||||
final Object? cause;
|
||||
|
||||
@override
|
||||
String toString() => 'AppException: $message';
|
||||
}
|
||||
|
||||
/// Network-related errors (connection, timeout, etc.)
|
||||
class NetworkException extends AppException {
|
||||
const NetworkException({required super.message, super.cause});
|
||||
}
|
||||
|
||||
/// API errors with HTTP status codes.
|
||||
class ApiException extends AppException {
|
||||
const ApiException({
|
||||
required super.message,
|
||||
required this.statusCode,
|
||||
this.code,
|
||||
super.cause,
|
||||
});
|
||||
|
||||
final int statusCode;
|
||||
final String? code;
|
||||
|
||||
bool get isUnauthorized => statusCode == 401;
|
||||
bool get isForbidden => statusCode == 403;
|
||||
bool get isNotFound => statusCode == 404;
|
||||
bool get isServerError => statusCode >= 500;
|
||||
}
|
||||
|
||||
/// Authentication-related errors.
|
||||
class AuthException extends AppException {
|
||||
const AuthException({required super.message, super.cause});
|
||||
}
|
||||
|
||||
/// Cache/storage errors.
|
||||
class CacheException extends AppException {
|
||||
const CacheException({required super.message, super.cause});
|
||||
}
|
||||
|
||||
/// Validation errors.
|
||||
class ValidationException extends AppException {
|
||||
const ValidationException({
|
||||
required super.message,
|
||||
this.fieldErrors = const {},
|
||||
});
|
||||
|
||||
final Map<String, String> fieldErrors;
|
||||
}
|
||||
Reference in New Issue
Block a user