Open
Description
Request Statement
Following #2139 we should update the Interceptor
function return types.
But this is a breaking change so we can only do this for dio 6.0.0.
Solution Brainstorm
class Interceptor {
/// The constructor only helps sub-classes to inherit from.
/// Do not use it directly.
const Interceptor();
/// Called when the request is about to be sent.
FutureOr<void> onRequest(
RequestOptions options,
RequestInterceptorHandler handler,
) {
handler.next(options);
}
/// Called when the response is about to be resolved.
FutureOr<void> onResponse(
Response response,
ResponseInterceptorHandler handler,
) {
handler.next(response);
}
/// Called when an exception was occurred during the request.
FutureOr<void> onError(
DioException err,
ErrorInterceptorHandler handler,
) {
handler.next(err);
}
}