DartClock class

Monotonic clock based on Dart's Stopwatch that is not influenced by system time changes.

Note: The behavior of Stopwatch during system suspension is inconsistent across platforms.

  • Android: The clock stops ticking during system sleep
  • ios: The clock keep ticking during system sleep.

This is the recommend clock to use on ios

Inheritance
Mixed-in types

Constructors

DartClock.new()
Default constructor
DartClock.create(Stopwatch stopwatch)
Custom constructor mostly used for testing

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startTime DateTime
Wall clock start time
getter/setter pairinherited

Methods

duration() Duration
The current Duration since the timer was started
inherited
durationMicros() int
The current number of microseconds since the timer was started
inherited
durationMillis() int
The current number of milliseconds since the timer was started
inherited
durationNanos() int
The current number of nanoseconds since the timer was started
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
now() DateTime
The current DateTime
inherited
nowMicros() int
The current number of microseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
inherited
nowMillis() int
The current number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
inherited
nowNanos() int
The current number of nanoseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
inherited
start() → void
Start the clock calling any now before the clock is started will throw an exception!
override
toString() String
A string representation of this object.
inherited

Operators

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