TimeOfDay class

Represents a time of day with hour, minute, and second.

Provides constructors for various time representations including AM/PM notation, DateTime conversion, and Duration conversion.

Constructors

TimeOfDay({required int hour, required int minute, int second = 0})
Creates a TimeOfDay with specified components.
const
TimeOfDay.am({required int hour, required int minute, int second = 0})
Creates an AM time.
const
TimeOfDay.fromDateTime(DateTime dateTime)
Creates a TimeOfDay from a DateTime.
TimeOfDay.fromDuration(Duration duration)
Creates a TimeOfDay from a Duration.
TimeOfDay.now()
Creates a TimeOfDay representing the current time.
TimeOfDay.pm({required int hour, required int minute, int second = 0})
Creates a PM time (adds 12 to the hour).
const

Properties

hashCode → int
The hash code for this object.
no setteroverride
hour → int
Hour component (0-23).
final
minute → int
Minute component (0-59).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
second → int
Second component (0-59).
final

Methods

copyWith({ValueGetter<int>? hour, ValueGetter<int>? minute, ValueGetter<int>? second}) → TimeOfDay
Creates a copy with specified fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replacing({int? hour, int? minute, int? second}) → TimeOfDay
For backward compatibility
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override