Config class

Constructors

Config({String baseUrl = '', CreateHttpClient? createHttpClient, ValidateCertificate? badCertificateCallback, Duration connectTimeout = const Duration(seconds: 30), Duration receiveTimeout = const Duration(seconds: 30), String code = 'code', String data = 'data', String list = 'data/list', String message = 'message', String validCode = '0', String? errorTimeout = '网络请求超时', String? errorConnection = '网络连接出错,请检查网络连接', String? errorBadResponse = '服务器错误,请稍后重试', String? errorCancel = '请求被取消了', String? errorUnknown = '网络连接不稳定,请检查网络连接'})

Properties

badCertificateCallback → ValidateCertificate?
Sets a callback that will decide whether to accept a secure connection with a server certificate that cannot be authenticated by any of our trusted root certificates. badCertificateCallback: (cert, String host, int port) { return true; },
final
baseUrl String
Request base url,
final
code String
final
connectTimeout Duration
second
final
createHttpClient ↔ CreateHttpClient?
createHttpClient: () { // Don't trust any certificate just because their root cert is trusted. final client = HttpClient(context: SecurityContext(withTrustedRoots: false)); // You can test the intermediate / root cert here. We just ignore it. client.badCertificateCallback = (cert, host, port) => true; // Config the client. client.findProxy = (uri) { // Forward all request to proxy "localhost:8888". // Be aware, the proxy should went through you running device, // not the host platform. return "PROXY localhost:8888"; }; return client; },
getter/setter pair
data String
final
errorBadResponse String?
The DioException was caused by an incorrect status code as configured by ValidateStatus.
final
errorCancel String?
When the request is cancelled, dio will throw a error with this type.
final
errorConnection String?
Caused for example by a xhr.onError or SocketExceptions. or Caused by an incorrect certificate as configured by ValidateCertificate.
final
errorTimeout String?
Caused by timeout
final
errorUnknown String?
Default error type, Some other Error. In this case, you can use the DioException.error if it is not null.
final
hashCode int
The hash code for this object.
no setterinherited
list String
final
message String
final
receiveTimeout Duration
second
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validCode String
final

Methods

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

Static Properties

catchLogEnable bool
getter/setter pair
logEnable bool
getter/setter pair