RxNet class
create_user: zhengzaihong email:1096877329@qq.com create_date: 2025-08-12 create_time: 16:48 describe: 此此变更较大,0.4版本之前为单例: 0.4.0版本开始支持多实例 RxNet 对象,用于多场景(如:一个请求业务API,一个请求日志API) RxNet 整体进行了优化:1.async/await 方式支持缓存策略请求,2.回调方式保持不变,内部实现方式已优化
These changes are major, and there were single cases before version 0.4: Version 0.4.0 starts to support multi-instance RxNet objects for multiple scenarios (e.g., one request business API and one request log API) RxNet has been optimized as a whole: 1. The async/await method supports caching policy requests, 2. The callback method remains unchanged, and the internal implementation method has been optimized
Properties
- cacheManager ↔ CacheManager
-
latefinal
- client → Dio?
-
no setter
- debugManager ↔ DebugManager
-
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- logManager ↔ LogManager
-
latefinal
-
logsNotifier
→ ValueNotifier<
List< String> > -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cacheLogToFile(
String filePath) → void -
deleteRequest<
T> () → BuildRequest< T> -
getBaseCacheMode(
) → CacheMode? -
getCacheInvalidationTime(
) → int -
getCheckNetWork(
) → CheckNetWork? -
getClient(
) → Dio? -
getHeaders(
) → Map< String, dynamic> -
getIgnoreCacheKeys(
) → List< String> ? -
getRequest<
T> () → BuildRequest< T> -
initNet(
{required String baseUrl, Directory? cacheDir, String cacheName = 'app_local_data', CacheMode baseCacheMode = CacheMode.ONLY_REQUEST, List< Interceptor> ? interceptors, BaseOptions? baseOptions, bool systemLog = false, CheckNetWork? baseCheckNet, List<String> ? ignoreCacheKeys, HiveCipher? encryptionCipher, Map<String, dynamic> ? baseUrlEnv, int cacheInvalidationTime = 365 * 24 * 60 * 60 * 1000, double debugWindowWidth = 800, double debugWindowHeight = 600}) → Future<void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patchRequest<
T> () → BuildRequest< T> -
postRequest<
T> () → BuildRequest< T> -
putRequest<
T> () → BuildRequest< T> -
setCollectLogs(
bool collect) → void -
setEnv(
String env) → void -
setHeaders(
Map< String, dynamic> header) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
debugWindow
↔ ValueNotifier<
Size> -
getter/setter pair
- I → RxNet
-
final
Static Methods
-
create(
) → RxNet -
delete<
T> ({String path = ""}) → BuildRequest -
get<
T> ({String path = ""}) → BuildRequest -
getDefaultClient(
) → Dio? -
getGlobalHeaders(
) → Map< String, dynamic> -
init(
{required String baseUrl, Directory? cacheDir, String cacheName = 'app_local_data', CacheMode baseCacheMode = CacheMode.ONLY_REQUEST, List< Interceptor> ? interceptors, BaseOptions? baseOptions, bool systemLog = false, CheckNetWork? baseCheckNet, List<String> ? ignoreCacheKeys, HiveCipher? encryptionCipher, Map<String, dynamic> ? baseUrlEnv, int cacheInvalidationTime = 365 * 24 * 60 * 60 * 1000, double debugWindowWidth = 800, double debugWindowHeight = 600}) → Future<void> - 中文: baseUrl:服务端基础地址 cacheDir:缓存目录 cacheName:缓存文件 baseCacheMode:缓存策略 interceptors:自定义的拦截器 systemLog:是否使用系统自带的打印 baseCheckNet:网络检测,外部自行实现,网络不通不发起请求 ignoreCacheKeys:网络检测,外部自行实现 encryptionCipher:数据加密,不传默认即可 baseUrlEnv:多环境的基础服务地址 cacheInvalidationTime:缓存时效:默认1年 debugWindowWidth:调试窗口默认宽 debugWindowHeight:调试窗口默认高
-
patch<
T> ({String path = ""}) → BuildRequest -
post<
T> ({String path = ""}) → BuildRequest -
put<
T> ({String path = ""}) → BuildRequest -
readCache(
String key) → Future -
saveCache(
String key, dynamic value) → void -
setDefaultEnv(
String env) → void -
setGlobalHeaders(
Map< String, dynamic> header) → void -
showDebugWindow(
BuildContext context) → void