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>
56 lines
1.2 KiB
Dart
56 lines
1.2 KiB
Dart
import 'package:dio/dio.dart';
|
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
|
|
import '../config/app_config.dart';
|
|
import 'api_interceptors.dart';
|
|
|
|
part 'api_client.g.dart';
|
|
|
|
/// Provides the Dio instance for Core API.
|
|
@riverpod
|
|
Dio coreApiClient(CoreApiClientRef ref) {
|
|
final dio = Dio(
|
|
BaseOptions(
|
|
baseUrl: AppConfig.coreApiUrl,
|
|
connectTimeout: const Duration(seconds: 10),
|
|
receiveTimeout: const Duration(seconds: 30),
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
},
|
|
),
|
|
);
|
|
|
|
dio.interceptors.addAll([
|
|
AuthInterceptor(ref),
|
|
LoggingInterceptor(),
|
|
ErrorInterceptor(),
|
|
]);
|
|
|
|
return dio;
|
|
}
|
|
|
|
/// Provides the Dio instance for Tatlock API.
|
|
@riverpod
|
|
Dio tatlockApiClient(TatlockApiClientRef ref) {
|
|
final dio = Dio(
|
|
BaseOptions(
|
|
baseUrl: AppConfig.tatlockApiUrl,
|
|
connectTimeout: const Duration(seconds: 10),
|
|
receiveTimeout: const Duration(minutes: 5), // Longer for LLM responses
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Accept': 'application/json',
|
|
},
|
|
),
|
|
);
|
|
|
|
dio.interceptors.addAll([
|
|
AuthInterceptor(ref),
|
|
LoggingInterceptor(),
|
|
ErrorInterceptor(),
|
|
]);
|
|
|
|
return dio;
|
|
}
|