NullableTimeOfDay class

Represents a time with nullable components (hour, minute, second).

Useful for time input scenarios where individual time parts may be missing or incomplete. Can convert to TimeOfDay when hour and minute are present.

Example:

final time = NullableTimeOfDay(hour: 14, minute: 30, second: 0);
print(time.toTimeOfDay); // TimeOfDay(hour: 14, minute: 30)

Constructors

NullableTimeOfDay({int? hour, int? minute, int? second})
Creates a NullableTimeOfDay.

Properties

hashCode int
The hash code for this object.
no setteroverride
hour int?
The hour component (nullable, 0-23).
final
minute int?
The minute component (nullable, 0-59).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int?
The second component (nullable, 0-59).
final
toTimeOfDay TimeOfDay?
Converts to TimeOfDay if hour and minute are present.
no setter

Methods

copyWith({ValueGetter<int?>? hour, ValueGetter<int?>? minute, ValueGetter<int?>? second}) NullableTimeOfDay
Creates a copy with specified parts replaced.
getTimeOfDay({int? defaultHour = 0, int? defaultMinute = 0, int? defaultSecond = 0}) TimeOfDay?
Converts to TimeOfDay with default values if any part is null.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<TimePart, int>
Converts to a map of time parts.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](TimePart part) int?
Retrieves the value of a specific time part.

Static Methods

fromTimeOfDay(TimeOfDay? timeOfDay) NullableTimeOfDay?
Creates a NullableTimeOfDay from a TimeOfDay.