networking

Installation
SKILL.md

Networking with Dio

  • Use Dio as the primary HTTP client package.
  • Use type-safe model classes with fromJson / toJson factories for all request/response bodies.
  • Handle all HTTP status codes appropriately with typed exceptions (e.g., ServerException, NetworkException, UnauthorizedException).
  • Use proper request timeouts (connectTimeout, receiveTimeout, sendTimeout).

Dio Interceptors

  • Use interceptors for cross-cutting concerns:
    • Auth Interceptor: Attach access tokens to headers, handle token refresh on 401.
    • Logging Interceptor: Log requests/responses in debug mode via AppLogger.
    • Error Interceptor: Transform DioException into domain-specific Failure types.
  • Register interceptors centrally via injectable for consistent behavior across all API calls.

Repository Pattern

  • DataSources contain only raw Dio API calls — no business logic or mapping
  • Repositories orchestrate between remote DataSources and local cache for network data
Related skills
Installs
4
GitHub Stars
18
First Seen
Mar 2, 2026