Time class

Time object

Time(11,30,45) is 11:30:45

Implementers

Constructors

Time({required int hour, int minute = 0, int second = 0, int millisecond = 0})
initialize Time object
const
Time.from(DateTime dateTime)
factory
Time.fromDuration(Duration duration)
Create a Time from duration
factory
Time.fromMilliseconds(int totalMilliseconds)
Create a Time from milliseconds
factory
Time.fromMinutes(int amount)
factory
Time.fromSeconds(int amount)
factory

Properties

asDateTime DateTime
Convert to DateTime
no setter
asOverflowed OverflowedTime
Convert to OverflowedTime representation
no setter
duration Duration
Represents the Time in Duration
no setter
hashCode int
The hash code for this object.
no setteroverride
hour int
Represents hours
final
inMilliseconds int
Represents the Time in milliseconds or total milliseconds
no setter
inMins int
Represents the Time in minutes or total minutes
no setter
inSeconds int
Represents the Time in seconds or total seconds
no setter
key String
/////////////////////////////// KEY Convert Time to a unique id (using dash, most db system won't accept : as id)
no setter
millisecond int
Represents the milliseconds [0...999]
final
minute int
Represents minutes
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
Represents seconds
final
title String
Represent the time as a String in the format HH:mm:ss:SSS
no setter

Methods

addDuration(Duration dur) Time
////////////////////////////////// OPERATIONS
addHours(int amount) Time
Add hours and may be Overflowed
addMinutes(int amount) Time
Add minutes and may be Overflowed
addSeconds(int amount) Time
Add seconds and may be Overflowed
closeTo(Time anotherTime, {Duration delta = const Duration(seconds: 1)}) bool
Close to another Time
compareTo(Time other) int
Comparator function used for sorting purpose
copyWith({int? hour, int? minute, int? second}) Time
format([TimeStringFormat format = TimeStringFormat.HHmmssSSS]) String
Format the Time to String
isAfter(Time time, {bool orSame = false}) bool
////////////////////////////////// COMPARISON Is the Time after another time
isBefore(Time time, {bool orSame = false}) bool
Is the Time before another time
isWithinRange(Time start, Time end) bool
Return true if time is within start and end
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overflowBy(int days) OverflowedTime
Keep days
roundToTheNearestMin(int stepInMin, {bool back = false}) Time
Round the time to next nearest
toString() String
Represent the time as a String in the format HH:mm:ss
override
toStringWithSeparator(String separator) String
Get the formatted String with the separator between each part
withDate(Date date) DateTime
Convert to DateTime with the given date

Operators

operator *(num times) Time
operator +(Time other) Time
operator -(Time other) Time
operator /(num times) Time
operator <(Time other) bool
operator <=(Time other) bool
operator ==(Object other) bool
The equality operator.
override
operator >(Time other) bool
operator >=(Time other) bool

Static Properties

utcNow Time
UTC Now
no setter

Static Methods

fromKey(String key) Time?
Convert a unique id to Time
fromStr(String? str, {String separator = ':', TimeFormatType formatType = TimeFormatType.hourFirst}) Time?
Tries to convert a string to Time
now() Time
Now

Constants

defaultSeparator → const String
Default separator
minutesInDay → const int
Total minutes in a day
secondsInDay → const int
Total seconds in a day