ManualCountmanClock class
可手动推进的时钟,供业务模拟和测试使用,无需真实等待。
- Implemented types
Constructors
- ManualCountmanClock({DateTime? wallTime, Duration monotonic = Duration.zero})
-
wallTime默认 Unix epoch,monotonic默认零。 例如ManualCountmanClock(wallTime: DateTime(2026))。
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
advance(
Duration duration) → void -
同时推进双钟;
duration必须非负,例如advance(Duration(seconds: 1))。 -
jumpWall(
Duration duration) → void -
只跳变墙钟;
duration可正可负,用于模拟前台系统校时。 -
monotonicMicros(
) → int -
当前单调微秒,包含模拟深睡补偿。
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
suspend(
Duration duration) → void - 模拟 paused→resumed,期间只有墙钟推进;使用系统的超过一秒校准规则。
-
toString(
) → String -
A string representation of this object.
inherited
-
wallMicros(
) → int -
当前墙钟微秒。
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited