DurationX extension
A suite of utilities and overrides extending Duration to support arithmetic, accurate double conversions, and standardized string formatting features.
- on
Properties
- abs → Duration
-
Available on Duration, provided by the DurationX extension
Computes the absolute value of the duration.no setter -
delay
→ Future<
void> -
Available on Duration, provided by the DurationX extension
await 3.seconds.delay— reads naturally in async code.no setter - inDaysDouble → double
-
Available on Duration, provided by the DurationX extension
Total duration in fractional days.no setter - inHoursDouble → double
-
Available on Duration, provided by the DurationX extension
Total duration in fractional hours.no setter - inMillisecondsDouble → double
-
Available on Duration, provided by the DurationX extension
Total duration in fractional milliseconds.no setter - inMinutesDouble → double
-
Available on Duration, provided by the DurationX extension
Total duration in fractional minutes.no setter - inSecondsDouble → double
-
Available on Duration, provided by the DurationX extension
Total duration in fractional seconds.no setter - inWeeksDouble → double
-
Available on Duration, provided by the DurationX extension
Total duration in fractional weeks.no setter - isNegative → bool
-
Available on Duration, provided by the DurationX extension
Returns true if the duration is functionally negative (<0 microseconds).no setter - isPositive → bool
-
Available on Duration, provided by the DurationX extension
Returns true if the duration is functionally positive (>0 microseconds).no setter - isZero → bool
-
Available on Duration, provided by the DurationX extension
Returns true if the duration is exactly zero.no setter
Methods
-
clamp(
Duration min, Duration max) → Duration -
Available on Duration, provided by the DurationX extension
Clamps this duration betweenminandmax. -
coerceAtLeast(
Duration min) → Duration -
Available on Duration, provided by the DurationX extension
Ensures this duration is at leastmin. -
coerceAtMost(
Duration max) → Duration -
Available on Duration, provided by the DurationX extension
Ensures this duration is at mostmax. -
delayed<
T> (T callback()) → Future< T> -
Available on Duration, provided by the DurationX extension
Runscallbackafter this duration. -
toHHMMSS(
) → String -
Available on Duration, provided by the DurationX extension
HH:MM:SS— useful for display in timers/players. -
toHuman(
) → String -
Available on Duration, provided by the DurationX extension
Human-readable:2h 30m,45s,200ms.
Operators
-
operator *(
num factor) → Duration -
Available on Duration, provided by the DurationX extension
Scales this duration byfactor. -
operator /(
num factor) → Duration -
Available on Duration, provided by the DurationX extension
Divides this duration byfactor.