LoggerPlugin class

日志插件

在 debug 模式下记录请求和响应信息。 使用 TalkerDioLogger 实现,懒加载安装到 Dio 实例。 priority = 10(最先执行,记录原始请求)

Inheritance

Constructors

LoggerPlugin({TalkerDioLoggerSettings settings = const TalkerDioLoggerSettings(printRequestHeaders: true, printResponseHeaders: false, printResponseMessage: true)})

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
插件名称(用于调试)
no setteroverride
priority int
优先级,数字越小越先执行,默认 100
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
settings TalkerDioLoggerSettings
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError(RequestContext ctx, SmartError error) Future<void>
错误发生时调用
override
onFinish(RequestContext ctx) Future<void>
请求结束后调用(无论成功失败都会执行)
inherited
onRequest(RequestContext ctx, RequestOptions options) Future<void>
请求发送前调用(可修改 RequestOptions)
inherited
onResponse(RequestContext ctx, Response response) Future<void>
响应接收后调用
inherited
onStart(RequestContext ctx) Future<void>
请求开始前调用
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

resetInstallState() → void
重置安装状态(用于测试)