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
objectconst - Time.from(DateTime dateTime)
-
factory
- Time.fromDuration(Duration duration)
-
Create a
Time
from durationfactory - Time.fromMilliseconds(int totalMilliseconds)
-
Create a
Time
from millisecondsfactory - Time.fromMinutes(int amount)
-
factory
- Time.fromSeconds(int amount)
-
factory
Properties
- asDateTime → DateTime
-
Convert to DateTime
no setter
- asOverflowed → OverflowedTime
-
Convert to
OverflowedTime
representationno 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 millisecondsno setter - inMins → int
-
Represents the
Time
in minutes or total minutesno setter - inSeconds → int
-
Represents the
Time
in seconds or total secondsno 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 formatHH: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
toString
-
isAfter(
Time time, {bool orSame = false}) → bool -
////////////////////////////////// COMPARISON
Is the
Time
after anothertime
-
isBefore(
Time time, {bool orSame = false}) → bool -
Is the
Time
before anothertime
-
isWithinRange(
Time start, Time end) → bool -
Return true if time is within
start
andend
-
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 formatHH:mm:ss
override -
toStringWithSeparator(
String separator) → String -
Get the formatted
String
with theseparator
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 Methods
Constants
- defaultSeparator → const String
- Default separator
- minutesInDay → const int
- Total minutes in a day
- secondsInDay → const int
- Total seconds in a day