HttpDioConfig constructor

HttpDioConfig({
  1. int connectTimeout = 15000,
  2. int receiveTimeout = 15000,
  3. dynamic successCode = 200,
  4. int tokenInvalidCode = 401,
  5. String errorMessage = "",
  6. String baseUrl = "",
  7. bool isNeedProxy = false,
  8. String? proxyHost,
  9. Map<String, dynamic>? headers,
  10. InterceptorsWrapper? headerInterceptor,
  11. InterceptorsWrapper? tokenInterceptor,
  12. InterceptorsWrapper? logInterceptor,
  13. List<InterceptorsWrapper>? interceptors,
  14. LoadingConfig? loadingConfig,
  15. String? language,
  16. bool isPrintNetworkLog = true,
})

Implementation

HttpDioConfig(
    {int connectTimeout = 15000,
    int receiveTimeout = 15000,
    dynamic successCode = 200,
    int tokenInvalidCode = 401,
    String errorMessage = "",
    String baseUrl = "",
    bool isNeedProxy = false,
    String? proxyHost,
    Map<String, dynamic>? headers,
    InterceptorsWrapper? headerInterceptor,
    InterceptorsWrapper? tokenInterceptor,
    InterceptorsWrapper? logInterceptor,
    List<InterceptorsWrapper>? interceptors,
    LoadingConfig? loadingConfig,
    String? language,
    bool isPrintNetworkLog = true}) {
  this.connectTimeout = connectTimeout == 0 ? this.connectTimeout : connectTimeout;
  this.receiveTimeout = receiveTimeout == 0 ? this.receiveTimeout : connectTimeout;
  this.successCode = successCode;
  this.tokenInvalidCode = tokenInvalidCode;
  this.errorMessage = errorMessage;
  this.baseUrl = baseUrl;
  this.headerInterceptor = headerInterceptor ?? this.headerInterceptor;
  this.tokenInterceptor = tokenInterceptor ?? this.tokenInterceptor;
  this.logInterceptor = logInterceptor ?? this.logInterceptor;
  this.isNeedProxy = isNeedProxy;
  // String proxy = proxyHost ?? "";
  this.proxyHost = "PROXY $proxyHost";
  this.headers = headers ?? this.headers;
  this.interceptors = interceptors ?? this.interceptors;
  this.loadingConfig = loadingConfig ?? LoadingConfig();
  this.language = language ?? "zh";
  this.isPrintNetworkLog = isPrintNetworkLog;
}