SystemClock class

Singleton implementation of Clock which reads the current system time. It is recommended that for anything other than throwaway code, this is only referenced in a single place in your code: where you provide a value to inject into the rest of your application, which should only depend on the interface.

Inheritance
Annotations
  • @immutable

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

getCurrentInstant() Instant
Gets the current time as an Instant.
override
inTzdbSystemDefaultZone() Future<ZonedClock>
Constructs a ZonedClock from a clock (the target of the method), in the TZDB mapping for the system default time zone time zone and the ISO calendar system.
inherited
inUtc() ZonedClock
Constructs a ZonedClock from a clock (the target of the method), using the UTC time zone and ISO calendar system.
inherited
inZone(DateTimeZone zone, [CalendarSystem? calendar]) ZonedClock
Constructs a ZonedClock from a clock (the target of the method), a time zone, and a calendar system.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance SystemClock
The singleton instance of SystemClock.
final