PollingTask class

轮询任务管理器:用于统一管理多个定时任务

start 方法可以启动一个新的轮询任务,

stop 方法可以停止指定的任务,

stopAll 方法可以停止所有任务,

isRunning 方法可以检查指定任务是否正在运行,

runningIds 属性可以获取当前所有正在运行的任务 ID 列表。

Constructors

PollingTask()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runningIds List<String>
获取所有当前任务 ID
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

isRunning(String id) bool
检查任务是否运行中
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start({required String id, required Duration interval, required VoidCallback onTick, bool restartIfExists = true}) → void
启动一个轮询任务
stop(String id) → void
停止一个任务
stopAll() → void
停止全部任务
toString() String
A string representation of this object.
inherited

Operators

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