DefaultHttpConfigImpl class

默认的http配置,

Inheritance

Constructors

DefaultHttpConfigImpl()

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

configBaseOptions() BaseOptions
配置通用的http请求选项BaseOptions 优先级最低,优先取Api#request方法中配置的method和option
override
configHttpResultErrorCode(Map<String, dynamic> data) String
配置错误code
override
configHttpResultErrorMessage(Map<String, dynamic> data) String
配置错误的描述信息
override
configHttpResultIsSuccess(Map<String, dynamic> data) bool
配置http请求成功的条件 参考 DefaultHttpConfigImpl data 请求的元数据
override
configHttps(X509Certificate cert, String host, int port) bool
配置https,默认为true,表示不检验证书,
inherited
configInterceptors() List<Interceptor>?
添加拦截器 公共请求头可以使用拦截器添加 拦截器队列的执行顺序是FIFO,先添加的拦截器先执行
inherited
configLoadingText() String
配置默认值:http加载提示文本
inherited
configLogEnable() bool
是否自动添加LogInterceptors默认日志拦截器,打印http请求响应相关的日志
inherited
getBaseUrl(String url) String?
如果url中不包含baseUrl,请求前回调该方法获取baseUrl 优先级高于IHttpConfig#configBaseOptions方法配置的baseUrl url 当前正在请求的接口url return: 返回null使用IHttpConfig#configBaseOptions方法配置的baseUrl
override
hideLoading(String url, int tag, bool isCancelled) → void
请求完成,关闭加载框:Api#request方法isShowLoading字段为true时,会回调该方法 url 当前请求url tag当前请求对应的tag,唯一 isCancelled当前请求是否已经取消,如果已经取消则不用关闭dialog
override
isCancelableDialog() bool
配置默认值:加载中能否通过关闭加载弹窗取消请求
inherited
isCheckNetwork() bool
配置默认值:请求前是否校验网络连接 true:如果无网络,直接返回错误
inherited
isHttpRespTokenError(Map<String, dynamic> data) bool
http请求失败时会回调该方法,判断是否是token失效导致的错误 errorBean 请求失败对象
inherited
isShowFailToast() bool
配置默认值:请求失败时是否自动显示toast提示错误
override
isShowLoading() bool
配置默认值:http请求时是否显示加载dialog
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTokenErrorCallback() → void
token失效回调该方法 errorBean 请求失败对象
override
showLoading(String url, int tag, CancelToken cancelToken, String loadingText, bool isCancelableDialog) → void
http请求显示加载框:Api#request方法isShowLoading字段为true时,会回调该方法
url 当前请求url
tag 当前请求对应的tag,唯一
cancelToken 用于加载框关闭时取消http请求
loadingText 加载提示提示
isCancelableDialog 请求过程中能否关闭加载框,默认false
#desc: 不提供默认的loading ,flutter 的dialog 需要context,而quick则不会保留context。
override
toString() String
A string representation of this object.
inherited

Operators

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

Constants

baseUrl → const String
httpTimeOut → const int