What problem does it solve?
This Skill provides standardized Dio interceptors to centralize authentication, error translation, and request/response logging for Flutter apps, reducing duplicated network handling and improving reliability.
Core Features & Use Cases
- Auth Interceptor: Attaches Bearer tokens to requests and coordinates a single concurrent token refresh with a retry queue for failed 401 requests.
- Error Interceptor: Maps DioException types and HTTP status codes into app-level typed exceptions such as UnauthorizedException, TimeoutException, NotFoundException, BadRequestException, and ServerException.
- Logging Interceptor: Emits request/response/error logs only in debug builds using kDebugMode to avoid leaking information in production.
- Use Case: Integrate these interceptors in a Flutter client to transparently handle token expiry, provide consistent error semantics to data sources, and keep production logs silent.
Quick Start
Implement AuthInterceptor, ErrorInterceptor, and LoggingInterceptor as described to attach bearer tokens, perform a single token refresh with a queued retry mechanism on 401 responses, and map Dio exceptions to typed app errors while logging only in debug builds.