InterceptedHttp.build constructor
InterceptedHttp.build({
- required List<
InterceptorContract> interceptors, - Duration? requestTimeout,
- TimeoutCallback? onRequestTimeout,
- RetryPolicy? retryPolicy,
- Client? client,
Builds a new InterceptedHttp instance. It helps avoid creating and
managing your own Client
instances.
Interceptors are applied in a linear order. For example a list that looks like this:
InterceptedClient.build(
interceptors: [
WeatherApiInterceptor(),
LoggerInterceptor(),
],
),
Will apply first the WeatherApiInterceptor
interceptor, so when
LoggerInterceptor
receives the request/response it has already been
intercepted.
Implementation
factory InterceptedHttp.build({
required List<InterceptorContract> interceptors,
Duration? requestTimeout,
TimeoutCallback? onRequestTimeout,
RetryPolicy? retryPolicy,
Client? client,
}) =>
InterceptedHttp._internal(
interceptors: interceptors,
requestTimeout: requestTimeout,
onRequestTimeout: onRequestTimeout,
retryPolicy: retryPolicy,
client: client,
);