ResponseInterceptor class

Interface to implements a response interceptor. Not recommended to modify body inside interceptor, see Converter to decode body response.

ResponseInterceptor are call after Converter.convertResponse.

See builtin interceptor HttpLoggingInterceptor

class MyResponseInterceptor  implements ResponseInterceptor {
  String _token;

  @override
  FutureOr<Response> onResponse(Response response) {
    _token ??= response.headers['auth_token'];
    return response;
  }
}
Implementers
Annotations

Constructors

ResponseInterceptor()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onResponse(Response response) FutureOr<Response>
toString() String
Returns a string representation of this object.
inherited

Operators

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