26 lines
886 B
Dart
26 lines
886 B
Dart
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|
import '../network/dio_client.dart';
|
|
import '../storage/secure_storage.dart';
|
|
|
|
part 'core_providers.g.dart';
|
|
|
|
/// Provider for DioClient (singleton)
|
|
///
|
|
/// This is the global HTTP client used across the entire app.
|
|
/// It's configured with interceptors, timeout settings, auth token injection,
|
|
/// and automatic token refresh on 401 errors.
|
|
@Riverpod(keepAlive: true)
|
|
DioClient dioClient(Ref ref) {
|
|
final storage = ref.watch(secureStorageProvider);
|
|
return DioClient(secureStorage: storage);
|
|
}
|
|
|
|
/// Provider for SecureStorage (singleton)
|
|
///
|
|
/// This is the global secure storage used for storing sensitive data like tokens.
|
|
/// Uses platform-specific secure storage (Keychain on iOS, EncryptedSharedPreferences on Android).
|
|
@Riverpod(keepAlive: true)
|
|
SecureStorage secureStorage(Ref ref) {
|
|
return SecureStorage();
|
|
}
|