RxNet class

create_user: zhengzaihong email:1096877329@qq.com create_date: 2022/8/9 create_time: 18:03 describe: 网络请求工具库,支持多种缓存模式 同一个CancelToken可以用于多个请求,当一个CancelToken取消时,所有使用该CancelToken的请求都会被取消。

Constructors

RxNet.new()
factory

Properties

client Dio?
no setter
collectLogs bool
no setter
debugWindowSizeNotifier ValueNotifier<Size>
调试窗口大小
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
logsNotifier ValueNotifier<List<String>>
收集的日志信息,用于界面呈现
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addLogs(String log) → void
cacheLogToFile(String filePath) → void
这里提供一个收集日字的方法,便于后期排查 文件需要有写的权限,eg:xxx/xxx/log.txt
clearLogs() → void
closeDebugWindow() → void
getClient() Dio?
getDb() RxNetDataBase?
getHeaders() Map<String, dynamic>
init({required String baseUrl, Directory? cacheDir, String cacheName = 'app_local_data', List<Interceptor>? interceptors, BaseOptions? baseOptions, bool isDebug = false, bool useSystemPrint = false, String? printTag, CheckNetWork? baseCheckNet, List<String>? ignoreCacheKeys, RequestCaptureError? requestCaptureError, CacheMode? baseCacheMode, HiveCipher? encryptionCipher, Map<String, dynamic>? baseUrlEnv, int cacheInvalidationTime = 365 * 24 * 60 * 60 * 1000, double debugWindowWidth = 600, double debugWindowHeight = 500}) Future<void>
初始化公共属性 baseUrl 地址前缀 interceptors 基础拦截器
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readCache(String key) Future
读取缓存 key 缓存key
saveCache(String key, dynamic value) Future
缓存 key 缓存key value 缓存值
setCollectLogs(bool collect) → void
setEnv(String env) → void
切换环境 env 环境名称 key 例如:debug,test,release
setHeaders(Map<String, dynamic> header) → void
设置全局请求头
showDebugWindow(BuildContext context) → void
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

maxRetryCount int
最大重试次数
getter/setter pair

Static Methods

delete<T>() BuildRequest
get<T>() BuildRequest
patch<T>() BuildRequest
post<T>() BuildRequest
put<T>() BuildRequest