ClientConfig class

Configuration class for Client.

Constructors

ClientConfig({ClientType clientType = ClientType.http, String? baseUrl, Duration connectTimeout = const Duration(seconds: 30), Duration receiveTimeout = const Duration(seconds: 30), Duration sendTimeout = const Duration(seconds: 30), Map<String, String> defaultHeaders = defaultJsonHeaders, List<ClientInterceptor> interceptors = const [], bool followRedirects = true, int maxRedirects = 5, bool validateCertificates = true, bool enableLogging = false, int maxRetries = 0, Duration retryDelay = const Duration(seconds: 1), bool exponentialBackoff = true, Set<int> retryStatusCodes = const {408, 429, 500, 502, 503, 504}, Set<int> successCodes = defaultSuccessCodes, Set<int> errorCodes = defaultErrorCodes})
const

Properties

baseUrl String?
Base URL to prepend to all requests.
final
clientType ClientType
The HTTP client type to use.
final
connectTimeout Duration
Default timeout for connection.
final
defaultHeaders Map<String, String>
Default headers to include in all requests.
final
enableLogging bool
Whether to enable logging (adds LoggingInterceptor if true).
final
errorCodes Set<int>
Default error status codes.
final
exponentialBackoff bool
Whether to use exponential backoff for retries.
final
followRedirects bool
Whether to follow redirects.
final
hashCode int
The hash code for this object.
no setterinherited
interceptors List<ClientInterceptor>
List of interceptors to apply to requests/responses.
final
maxRedirects int
Maximum number of redirects to follow.
final
maxRetries int
Maximum number of retries for failed requests.
final
receiveTimeout Duration
Default timeout for receiving data.
final
retryDelay Duration
Initial delay for retry backoff.
final
retryStatusCodes Set<int>
HTTP status codes that should trigger a retry.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout Duration
Default timeout for sending data.
final
successCodes Set<int>
Default success status codes.
final
validateCertificates bool
Whether to validate SSL certificates.
final

Methods

copyWith({ClientType? clientType, String? baseUrl, Duration? connectTimeout, Duration? receiveTimeout, Duration? sendTimeout, Map<String, String>? defaultHeaders, List<ClientInterceptor>? interceptors, bool? followRedirects, int? maxRedirects, bool? validateCertificates, bool? enableLogging, int? maxRetries, Duration? retryDelay, bool? exponentialBackoff, Set<int>? retryStatusCodes, Set<int>? successCodes, Set<int>? errorCodes}) ClientConfig
Creates a copy of this config with the specified changes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited