PausableTimer class final

A Timer that can be paused, resumed and reset.

This implementation is roughly based on this comment.

Implemented types

Constructors

PausableTimer(Duration duration, void callback())
Creates a new pausable timer.
PausableTimer.periodic(Duration duration, void callback())
Creates a new repeating pausable timer.

Properties

duration Duration
The original duration this Timer was created with.
final
elapsed Duration
The time this Timer have been active.
no setter
hashCode int
The hash code for this object.
no setterinherited
isActive bool
True if this Timer is armed and counting.
no setteroverride
isCancelled bool
True if this Timer was cancelled.
no setter
isExpired bool
True if this Timer has expired.
no setter
isPaused bool
True if this Timer is armed but not currently active.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tick int
The number of durations preceding the most recent timer event.
no setteroverride

Methods

cancel() → void
Cancels the timer.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
Pauses an active timer.
reset() → void
Resets the timer.
start() → void
Starts (or resumes) the timer.
toString() String
A string representation of this object.
inherited

Operators

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