Infrastructure high complexity Shared Component mobile
0
Dependencies
11
Dependents
2
Entities
0
Integrations

Description

Centralized HTTP client wrapping Dart's http or Dio with JWT bearer token injection, automatic token refresh on 401 responses, a 15-second timeout, and a typed ApiException hierarchy. Used by every feature that communicates with the REST API; Background Sync relies on it exclusively for dispatching outbox mutations.

Feature: Background Sync

api-http-client

Responsibilities

  • Attach Authorization header with current access token to every outgoing request
  • Intercept 401 responses and transparently refresh the access token before retrying
  • Map HTTP error responses to typed ApiException subclasses for structured error handling
  • Enforce request timeout and surface TimeoutException through the ApiException hierarchy

Interfaces

get(path: String, {Map<String, String>? headers}) -> Future<ApiResponse>
post(path: String, body: Map<String, dynamic>) -> Future<ApiResponse>
put(path: String, body: Map<String, dynamic>) -> Future<ApiResponse>
delete(path: String) -> Future<ApiResponse>
patch(path: String, body: Map<String, dynamic>) -> Future<ApiResponse>

Related Data Entities (2)

Data entities managed by this component