APISession<T> class
abstract
- Inheritance
-
- Object
- APIXSession
- APISession
- Mixed in types
-
- APIParseMixin<
T> - APIDioMixin<
T, APIResponder< T> > - APISessionMixin<
T, APIResponder< T> >
- APIParseMixin<
- Implementers
Constructors
Properties
- bodyFormat → BodyFormat?
-
请求体格式
no setterinherited
- config → APIConfig
-
全局配置
no setterinherited
- contentType → String?
-
Content-Type
no setterinherited
- data → Object?
-
请求体 默认 null
no setterinherited
- dio → Dio
-
no setterinherited
- extra → Parameters?
-
额外参数
no setterinherited
- followRedirects → bool?
-
跟随重定向
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- headers → HTTPHeader?
-
请求头 默认 null
no setterinherited
- listFormat → ListFormat?
-
数组格式
no setterinherited
- maxRedirects → int?
-
最大重定向次数
no setterinherited
- method → HTTPMethod
-
请求方式 默认 GET
no setterinherited
- options → Options?
-
请求配置
no setterinherited
- parameters → Parameters?
-
请求参数 默认 null
no setterinherited
-
parseJson
→ ParseJsonT<
T> -
json
转换函数no setterinherited - path → String
-
请求路径 默认 null
no setterinherited
- persistentConnection → bool?
-
持久化连接
no setterinherited
- prefixPath → String
-
跟随主域名后面的前缀
no setterinherited
- preserveHeaderCase → bool?
-
保留 Header 大小写
no setterinherited
- receiveDataWhenStatusError → bool?
-
状态错误时是否接收数据
no setterinherited
- receiveTimeout → Duration?
-
接收超时时间
no setterinherited
- requestEncoder → RequestEncoder?
-
请求编码
no setterinherited
- responseDecoder → ResponseDecoder?
-
响应解码
no setterinherited
- responseType → ResponseType?
-
响应类型
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sendTimeout → Duration?
-
发送超时时间
no setterinherited
- suffixPath → String
-
跟随主域名后面的后缀
no setterinherited
- url → String
-
请求 url, 由 prefixPath、path 和 suffixPath 组成
no setterinherited
- useBody → bool
-
是否将 parameters 转成 data 放入 Request Body 中,默认不放入请求体中
no setterinherited
- validateStatus → ValidateStatus?
-
请求状态校验
no setterinherited
Methods
-
cacheInterceptors(
{bool isCached = true}) → void -
inherited
-
createResponder(
dynamic data) → APIResponder< T> -
创建响应对象, 重写此方法可以自定义响应对象
inherited
-
decodeJson(
dynamic data) → APIResponder< T> -
inherited
-
fetch(
{HTTPMethod? method, Object? data, Parameters? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, bool? useBody, BodyFormat? bodyFormat, bool isCached = true}) → Future< T?> -
根据 responder 自动解析成对应的 model 并返回
inherited
-
fetchList(
{HTTPMethod? method, Object? data, Parameters? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, bool? useBody, BodyFormat? bodyFormat, bool isCached = true}) → Future< List< T> ?> -
根据 responder 自动解析成对应的 list model 并返回
inherited
-
fromJson(
dynamic json) → T -
将
json
转换为对应的T
类型inherited -
loggerInterceptors(
) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rawFetch(
{String? url, HTTPMethod? method, Object? data, Parameters? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, bool? useBody, BodyFormat? bodyFormat, bool isCached = true}) → Future -
inherited
-
rawRequest(
{String? url, HTTPMethod? method, Object? data, Parameters? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, bool? useBody, BodyFormat? bodyFormat, bool isCached = true}) → Future< Response> -
发送请求
参数优先级高于默认配置
如果设置了
options
, 则method
无效, 只会替换默认的 APIOptions.options 中的method
inherited -
request(
{HTTPMethod? method, Object? data, Parameters? queryParameters, CancelToken? cancelToken, Options? options, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, bool? useBody, BodyFormat? bodyFormat, bool isCached = true}) → Future< APIResponder< T> > -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited