HttpWithInterceptor class

Class to be used by the user as a replacement for 'http' with interceptor supported. call the build() constructor passing in the list of interceptors. Example:

HttpWithInterceptor http = HttpWithInterceptor.build(interceptors: [
    Logger(),
]);

Then call the functions you want to, on the created http object.

http.get(...);
http.post(...);
http.put(...);
http.delete(...);
http.head(...);
http.patch(...);
http.read(...);
http.readBytes(...);

Constructors

HttpWithInterceptor.build({required List<InterceptorContract> interceptors, Duration? requestTimeout, RetryPolicy? retryPolicy, bool badCertificateCallback(X509Certificate, String, int)?, String findProxy(Uri)?, Client? client})
factory

Properties

badCertificateCallback bool Function(X509Certificate, String, int)?
getter/setter pair
client ↔ Client?
getter/setter pair
findProxy String Function(Uri)?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
interceptors List<InterceptorContract>
getter/setter pair
requestTimeout Duration?
getter/setter pair
retryPolicy RetryPolicy?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

delete(dynamic url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
get(dynamic url, {Map<String, String>? headers, Map<String, String>? params}) Future<Response>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(dynamic url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
post(dynamic url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
put(dynamic url, {Map<String, String>? headers, Object? body, Encoding? encoding}) Future<Response>
read(dynamic url, {Map<String, String>? headers}) Future<String>
readBytes(dynamic url, {Map<String, String>? headers}) Future<Uint8List>
toString() String
A string representation of this object.
inherited

Operators

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