DfHttpClientConfig constructor

DfHttpClientConfig({
  1. required String baseApiUrl,
  2. Encoding? encoding,
  3. Map<String, String> headers = const {},
  4. int timeout = 10,
  5. bool retryApiCall = true,
  6. bool waitForTokenRefresh = true,
  7. int maxRetryAttempts = 3,
  8. Future<Result<String, Exception>> refreshToken()?,
})

Creates a new DfHttpClientConfig instance.

baseApiUrl is required and should be the base URL for your API.

  • encoding: Optional request/response encoding (e.g. UTF-8).
  • headers: Default headers added to every request.
  • timeout: Request timeout in seconds (default: 10).
  • retryApiCall: Whether failed API calls should automatically retry.
  • waitForTokenRefresh: Whether requests should wait until token refresh completes.
  • maxRetryAttempts: Maximum number of retry attempts for failed requests.
  • refreshToken: Callback used to refresh tokens if authentication fails.

Implementation

DfHttpClientConfig({
  required this.baseApiUrl,
  this.encoding,
  this.headers = const {},
  this.timeout = 10,
  this.retryApiCall = true,
  this.waitForTokenRefresh = true,
  this.maxRetryAttempts = 3,
  this.refreshToken,
});