APIConfig class

默认配置, 在调用 APISession 之前, 必须先调用 APICore.initialize 才会生效

Constructors

APIConfig({Dio? dio, String? baseUrl, Duration? connectTimeout = const Duration(seconds: 60), String? contentType, bool ensureNonNullHeadersFields = false, bool ensureNonNullParametersFields = false, Parameters? extra, bool? followRedirects, HTTPHeader? headers, bool isHandleErrors = false, ListFormat? listFormat, int? maxRedirects, HTTPMethod? method = HTTPMethod.GET, bool? persistentConnection, bool postBodyByDefault = false, BodyFormat? postBodyFormat, @Deprecated('Use `postBodyByDefault` and `postBodyFormat` instead, it will be removed in next version.') bool postUseFormData = false, String prefixPath = '', bool preserveHeaderCase = false, Parameters? queryParameters, bool? receiveDataWhenStatusError, Duration? receiveTimeout = const Duration(seconds: 60), RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, ResponseType? responseType = ResponseType.json, Duration? sendTimeout, String suffixPath = '', ValidateStatus? validateStatus})

Properties

baseUrl String?
默认 URL
final
connectTimeout Duration?
连接超时时间
final
contentType String?
Content-Type
final
dio Dio?
final
ensureNonNullHeadersFields bool
确保 Headers 字段不为空
final
ensureNonNullParametersFields bool
确保 Parameters 字段不为空
final
extra Parameters?
额外参数
final
followRedirects bool?
跟随重定向
final
hashCode int
The hash code for this object.
no setterinherited
headers HTTPHeader?
默认请求头
final
isHandleErrors bool
是否处理错误
final
listFormat ListFormat?
数组格式
final
maxRedirects int?
最大重定向次数
final
method HTTPMethod?
请求方式
final
persistentConnection bool?
持久化连接
final
postBodyByDefault bool
Post 方式默认使用 Request Body
final
postBodyFormat BodyFormat?
Post 时 Body 默认使用的格式
final
postUseFormData bool
Post 方式默认使用 FormData
final
prefixPath String
跟随主域名后面的前缀
final
preserveHeaderCase bool
保留 Header 大小写
final
queryParameters Parameters?
请求参数
final
receiveDataWhenStatusError bool?
状态错误时是否接收数据
final
receiveTimeout Duration?
接收超时时间
final
requestEncoder RequestEncoder?
请求编码
final
responseDecoder ResponseDecoder?
响应解码
final
responseType ResponseType?
响应类型
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendTimeout Duration?
发送超时时间
final
suffixPath String
跟随主域名后面的后缀
final
validateStatus ValidateStatus?
请求状态校验
final

Methods

copyWith({String? baseUrl, Duration? connectTimeout, String? contentType, bool? ensureNonNullHeadersFields, bool? ensureNonNullParametersFields, Parameters? extra, bool? followRedirects, HTTPHeader? headers, bool? isHandleErrors, bool? isToastErrors, ListFormat? listFormat, int? maxRedirects, HTTPMethod? method, bool? persistentConnection, bool? postBodyByDefault, BodyFormat? postBodyFormat, bool? postUseFormData, String? prefixPath, bool? preserveHeaderCase, Parameters? queryParameters, bool? receiveDataWhenStatusError, Duration? receiveTimeout, RequestEncoder? requestEncoder, ResponseDecoder? responseDecoder, ResponseType? responseType, Duration? sendTimeout, String? suffixPath, ValidateStatus? validateStatus}) APIConfig
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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