TimeSpan class

Represents a user-defined duration. Unlike Duration, this class does not normalize down to microseconds value, but preserves the original precision.

Constructors

TimeSpan({bool negated = false, int years = 0, int months = 0, int weeks = 0, int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int millis = 0, int micros = 0})
TimeSpan.ofISOString(String isoString)
factory
TimeSpan.ofParts(List<num?> parts, {bool negated = false})
TimeSpan.ofSingleField(dynamic field, num value)
factory

Properties

days → int
no setter
hashCode → int
The hash code for this object.
no setteroverride
hours → int
no setter
micros → int
no setter
millis → int
no setter
minutes → int
no setter
months → int
no setter
negated → bool
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
seconds → int
no setter
secondsDouble → num
no setter
weeks → int
no setter
years → int
no setter

Methods

format({Map<TimeSpanUnit, String?>? labels, String separator = " ", bool pluralize = true, bool separateLabel = true}) → String
formatCondensed([String separator = " "]) → String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDuration([DateTime? reference]) → Duration
toIso8601String() → String
toJson() → dynamic
toString() → String
A string representation of this object.
override

Operators

operator +(TimeSpan other) → TimeSpan
operator ==(Object other) → bool
The equality operator.
override
operator [](dynamic key) → int

Static Properties

zero → TimeSpan
final

Static Methods

fromJson(dynamic value) → TimeSpan?