PreloadTracker class

进度追踪器 — 监听任务状态变更,计算并推送进度更新

支持多次 execute() 调用(每次 start() 重置状态), 并对快速连续的进度更新进行去抖动,避免 UI 抖动。

Constructors

PreloadTracker({Duration debounceThreshold = const Duration(milliseconds: 50)})

Properties

contexts List<TaskExecutionContext>
获取所有任务上下文
no setter
debounceThreshold Duration
进度更新去抖动间隔
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state PreloadManagerState
当前管理器状态(暴露给 PreloadManager)
no setter
stream Stream<PreloadProgress>
进度流
no setter

Methods

cancelAll() → void
批量取消所有任务
complete(PreloadManagerState finalState) → void
完成追踪
dispose() → void
释放资源
getContext(String taskId) TaskExecutionContext?
获取任务上下文
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTaskCancelled(String taskId) → void
任务被取消
onTaskComplete(String taskId, dynamic result) → void
任务执行完成
onTaskFail(String taskId, Object error) → void
任务执行失败
onTaskStart(String taskId) → void
任务开始执行
reset() → void
重置追踪器(允许多次执行)
start(List<PreloadTask> tasks, [DateTime? startTime]) → void
启动追踪
toString() String
A string representation of this object.
inherited

Operators

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