InspectorDioInterceptor class
Dio拦截器实现 / Dio interceptor implementation 捕获Dio网络请求并记录到检查器服务 / Capture Dio network requests and record to inspector service
使用方式 / Usage:
import 'package:dio/dio.dart';
import 'package:zero_inspector_kit/zero_inspector_kit_dio.dart';
final dio = Dio();
dio.interceptors.add(
InterceptorWrapper(
onRequest: (options, handler) {
InspectorDioInterceptor().onRequest(options.toMap());
handler.next(options);
},
onResponse: (response, handler) {
InspectorDioInterceptor().onResponse(response.toMap());
handler.next(response);
},
onError: (error, handler) {
InspectorDioInterceptor().onError(error.toMap());
handler.next(error);
},
),
);
- Inheritance
-
- Object
- InspectorDioInterceptorBase
- InspectorDioInterceptor
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
-
onError(
Map< String, dynamic> error) → void -
请求失败回调 / Callback when request fails
error错误信息 / Error informationoverride -
onRequest(
Map< String, dynamic> options) → void -
请求发送前回调 / Callback before request is sent
options请求配置选项 / Request configuration optionsoverride -
onResponse(
Map< String, dynamic> response) → void -
请求成功响应回调 / Callback when request succeeds
response响应数据 / Response dataoverride -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited