InterceptedClient.build constructor
InterceptedClient.build({
- required List<
InterceptorContract> interceptors, - Duration? requestTimeout,
- TimeoutCallback? onRequestTimeout,
- RetryPolicy? retryPolicy,
- Client? client,
Builds a new InterceptedClient instance.
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 InterceptedClient.build({
required List<InterceptorContract> interceptors,
Duration? requestTimeout,
TimeoutCallback? onRequestTimeout,
RetryPolicy? retryPolicy,
Client? client,
}) =>
InterceptedClient._internal(
interceptors: interceptors,
requestTimeout: requestTimeout,
onRequestTimeout: onRequestTimeout,
retryPolicy: retryPolicy,
client: client,
);