HttpManager class

Properties

debug bool
no setter
hashCode int
The hash code for this object.
no setterinherited
onGlobalFailed OnGlobalFailed?
getter/setter pair
publicHeaders Map<String, dynamic>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearPublicHeader() → void
清空当前请求头
clearPublicQueryParams() → void
清空公共请求参数
download({required String urlPath, required String filename, Map<String, dynamic>? params, Map<String, dynamic>? body, Options? options, CancelToken? cancelToken, ProgressCallback? onProgress, OnSuccess<File?>? onSuccess, OnFailed? onFailed}) → void
下载文件,由于web端适配问题,没有通过Future的方式
getRespConfig() RespConfig
init({required String baseUrl, bool debug = false, RespConfig? respConfig, int connectTimeout = 15000, int receiveTimeout = 15000, Map<String, dynamic>? publicHeaders, Map<String, dynamic>? publicQueryParams, CacheConfig? cacheConfig, List<Interceptor>? interceptors}) Future<bool>
初始化
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestResponse({required String path, ReqType reqType = ReqType.get, Map<String, dynamic>? params, RespConfig? respConfig, Options? options, Map<String, dynamic>? body, CancelToken? cancelToken, CacheMode? cacheMode = CacheMode.ONLY_NETWORK, int? cacheTime, String? customCacheKey}) Future<Response>
需要异步调用的网络请求
requestWithFuture<T>({required String path, required OnFromJson<T>? onFromJson, ReqType reqType = ReqType.get, Map<String, dynamic>? params, Options? options, Map<String, dynamic>? body, CancelToken? cancelToken, RespConfig? respConfig, CacheMode? cacheMode = CacheMode.ONLY_NETWORK, int? cacheTime, String? customCacheKey}) Future<BaseResp<T>>
需要异步调用的网络请求
setPublicHeader(String key, String value) → void
设置请求头
setPublicHeaders(Map<String, String> headers) → void
批量设置请求头
setPublicQueryParam(String key, String value) → void
设置公共请求参数
setPublicQueryParams(Map<String, String> params) → void
批量设置公共请求参数
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

getInstance() HttpManager