HumanizedDuration extension

Formatting, arithmetic, and utility methods for Duration.

on

Properties

abs Duration

Available on Duration, provided by the HumanizedDuration extension

Returns the absolute non-negative value of this duration.
no setter
delay Future<void>

Available on Duration, provided by the HumanizedDuration extension

Waits for this duration.
no setter
hoursPart int

Available on Duration, provided by the HumanizedDuration extension

Returns the absolute hours component of the duration.
no setter
inDaysDouble double

Available on Duration, provided by the HumanizedDuration extension

Total duration in fractional days.
no setter
inHoursDouble double

Available on Duration, provided by the HumanizedDuration extension

Total duration in fractional hours.
no setter
inMillisecondsDouble double

Available on Duration, provided by the HumanizedDuration extension

Total duration in fractional milliseconds.
no setter
inMinutesDouble double

Available on Duration, provided by the HumanizedDuration extension

Total duration in fractional minutes.
no setter
inSecondsDouble double

Available on Duration, provided by the HumanizedDuration extension

Total duration in fractional seconds.
no setter
inWeeksDouble double

Available on Duration, provided by the HumanizedDuration extension

Total duration in fractional weeks.
no setter
isNegative bool

Available on Duration, provided by the HumanizedDuration extension

Returns true if this duration is less than zero.
no setter
isPositive bool

Available on Duration, provided by the HumanizedDuration extension

Returns true if this duration is greater than zero.
no setter
isZero bool

Available on Duration, provided by the HumanizedDuration extension

Returns true if this duration is exactly zero.
no setter
millisecondsPart int

Available on Duration, provided by the HumanizedDuration extension

Returns the absolute milliseconds component of the duration, from 0 to 999.
no setter
minutesPart int

Available on Duration, provided by the HumanizedDuration extension

Returns the absolute minutes component of the duration, from 0 to 59.
no setter
secondsPart int

Available on Duration, provided by the HumanizedDuration extension

Returns the absolute seconds component of the duration, from 0 to 59.
no setter
totalDays double

Available on Duration, provided by the HumanizedDuration extension

Returns the total duration in floating-point days.
no setter
totalHours double

Available on Duration, provided by the HumanizedDuration extension

Returns the total duration in floating-point hours.
no setter
totalMinutes double

Available on Duration, provided by the HumanizedDuration extension

Returns the total duration in floating-point minutes.
no setter

Methods

ceilToMinutes() Duration

Available on Duration, provided by the HumanizedDuration extension

Rounds this duration up to the nearest minute.
clamp(Duration min, Duration max) Duration

Available on Duration, provided by the HumanizedDuration extension

Clamps this duration between min and max.
coerceAtLeast(Duration min) Duration

Available on Duration, provided by the HumanizedDuration extension

Ensures this duration is at least min.
coerceAtMost(Duration max) Duration

Available on Duration, provided by the HumanizedDuration extension

Ensures this duration is at most max.
delayed<T>(T callback()) Future<T>

Available on Duration, provided by the HumanizedDuration extension

Runs callback after this duration.
floorToMinutes() Duration

Available on Duration, provided by the HumanizedDuration extension

Truncates this duration down to the nearest minute.
isLongerThan(Duration other) bool

Available on Duration, provided by the HumanizedDuration extension

Returns true if this duration is strictly longer than other.
isShorterThan(Duration other) bool

Available on Duration, provided by the HumanizedDuration extension

Returns true if this duration is strictly shorter than other.
isWithin(Duration range, Duration other) bool

Available on Duration, provided by the HumanizedDuration extension

Returns true if this duration is within range of other.
progressOf(Duration total, {bool clampResult = true}) double

Available on Duration, provided by the HumanizedDuration extension

Returns a 0.0-1.0 progress value relative to total.
remainingIn(Duration total) Duration

Available on Duration, provided by the HumanizedDuration extension

Remaining duration when this duration is elapsed within total.
roundToMinutes() Duration

Available on Duration, provided by the HumanizedDuration extension

Rounds this duration to the nearest minute.
roundToSeconds() Duration

Available on Duration, provided by the HumanizedDuration extension

Rounds this duration to the nearest second.
toFrames(double fps) int

Available on Duration, provided by the HumanizedDuration extension

Converts this duration to a frame count at fps.
toHHMMSS() String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration as HH:MM:SS or MM:SS.
toHuman() String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration as compact human-readable text.
toHumanizedString() String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration as 1:02:34 or 2:05.
toPaddedString() String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration as 01:02:34 or 02:05.
toRelativeString() String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration as relative text.
toSeconds() double

Available on Duration, provided by the HumanizedDuration extension

Total fractional seconds, including milliseconds.
toVerboseString({bool includeSeconds = true}) String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration as compact parts such as 1h 2m 34s.
toWordString({bool includeSeconds = true}) String

Available on Duration, provided by the HumanizedDuration extension

Formats this duration with fully written-out units.

Operators

operator *(num factor) Duration

Available on Duration, provided by the HumanizedDuration extension

Multiplies this duration by factor.
operator /(num divisor) Duration

Available on Duration, provided by the HumanizedDuration extension

Divides this duration by divisor.

Static Methods

fromFrames(int frames, double fps) Duration

Available on Duration, provided by the HumanizedDuration extension

Reconstructs a duration from frames at fps.