PreloadConfig class
预加载全局配置
Constructors
-
PreloadConfig({int maxConcurrentTasks = 3, Duration defaultTimeout = const Duration(seconds: 30), int maxRetries = 2, Duration retryBaseDelay = const Duration(milliseconds: 500), bool enableLogging = true, void onError(Object error, StackTrace? stackTrace)?, Duration defaultCheckRetryDelay = const Duration(milliseconds: 300), int defaultMaxCheckRetries = 10, Future<
bool> globalCheck()?, Duration? globalCheckRetryDelay, int? globalCheckMaxRetries}) -
const
Properties
- defaultCheckRetryDelay → Duration
-
默认执行前检查重试间隔
final
- defaultMaxCheckRetries → int
-
默认执行前检查最大重试次数
final
- defaultTimeout → Duration
-
默认任务超时时间
final
- enableLogging → bool
-
是否启用详细日志
final
-
globalCheck
→ Future<
bool> Function()? -
全局执行前检查 — 每个任务执行前都会调用
返回 true 表示可以执行,返回 false 则等待后重试
适用于检查应用状态(前台/后台)、网络连接、设备资源等全局前置条件
final
- globalCheckMaxRetries → int?
-
全局检查最大重试次数(null 使用 defaultMaxCheckRetries)
final
- globalCheckRetryDelay → Duration?
-
全局检查失败后的重试间隔(null 使用 defaultCheckRetryDelay)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxConcurrentTasks → int
-
最大并发任务数
final
- maxRetries → int
-
任务失败重试次数
final
- onError → void Function(Object error, StackTrace? stackTrace)?
-
全局错误处理回调
final
- retryBaseDelay → Duration
-
重试间隔基数(指数退避)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{int? maxConcurrentTasks, Duration? defaultTimeout, int? maxRetries, Duration? retryBaseDelay, bool? enableLogging, void onError(Object error, StackTrace? stackTrace)?, Duration? defaultCheckRetryDelay, int? defaultMaxCheckRetries, Future< bool> globalCheck()?, Duration? globalCheckRetryDelay, int? globalCheckMaxRetries}) → PreloadConfig - 创建副本并修改部分配置
-
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
Constants
- defaultConfig → const PreloadConfig
- 默认配置