An interface for implementing response interceptors.
ResponseInterceptors are called after Converter.convertResponse.
While ResponseInterceptors can modify the body of responses, converting (decoding) the response body should be handled by Converters.
See built-in HttpLoggingInterceptor for a fully functional example implementation.
A short example for extracting a header value from a response:
class MyResponseInterceptor implements ResponseInterceptor {
String _token;
@override
FutureOr<Response> onResponse(Response response) {
_token = response.headers['auth_token'];
return response;
}
}
- Implementers
- Annotations
-
- @immutable
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onResponse(
Response response) → FutureOr< Response> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited