Interceptors
Request
class MyRequestInterceptor implements Interceptor {
MyRequestInterceptor(this.token);
final String token;
@override
FutureOr<Response<BodyType>> intercept<BodyType>(Chain<BodyType> chain) async {
final request = applyHeader(chain.request, 'auth_token', 'Bearer $token');
return chain.proceed(request);
}
}Response
Breaking out of an interceptor
Builtins
Last updated