FlexHttpBuilder class
Builder class for configuring a FlexHttp instance.
Example:
final client = FlexHttpBuilder(baseUrl: 'https://api.example.com')
.withMaxRetries(3)
.withLogging(true)
.build();
Constructors
- FlexHttpBuilder({String? baseUrl})
Properties
- baseUrl ↔ String?
-
getter/setter pair
-
defaultHeaders
↔ Map<
String, String> -
getter/setter pair
- enableLogging ↔ bool
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
interceptors
↔ List<
FlexInterceptor> -
getter/setter pair
- maxConnectionsPerHost ↔ int
-
getter/setter pair
- maxRetries ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout ↔ Duration?
-
getter/setter pair
Methods
-
build(
) → FlexHttp - Builds and returns a configured FlexHttp instance.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
withBaseUrl(
String url) → FlexHttpBuilder - Sets the base URL for all requests.
-
withHeader(
String key, String value) → FlexHttpBuilder - Adds a default header to all requests.
-
withInterceptor(
FlexInterceptor interceptor) → FlexHttpBuilder - Adds an interceptor to the request pipeline.
-
withLogging(
bool enable) → FlexHttpBuilder - Enables or disables logging of requests and responses.
-
withMaxConnections(
int max) → FlexHttpBuilder - Sets the maximum number of connections per host.
-
withMaxRetries(
int retries) → FlexHttpBuilder - Sets the maximum number of retries for failed requests.
-
withTimeout(
Duration duration) → FlexHttpBuilder - Sets the timeout duration for requests.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited