DurationExtensions extension
Helpers for showing, waiting on and measuring Duration values.
await 2.seconds.delay; // waits 2 seconds
const Duration(minutes: 90).toPretty(); // '1h 30m'
const Duration(seconds: 3725).toClock(); // '01:02:05'
5.minutes.fromNow; // a DateTime 5 minutes ahead
- on
Properties
- ago → DateTime
-
Available on Duration, provided by the DurationExtensions extension
The time this long before now.no setter -
delay
→ Future<
void> -
Available on Duration, provided by the DurationExtensions extension
Waits for this long.no setter - fromNow → DateTime
-
Available on Duration, provided by the DurationExtensions extension
The time this long after now.no setter - inSecondsDecimal → double
-
Available on Duration, provided by the DurationExtensions extension
The length in seconds, including the part after the decimal point.no setter - inWeeks → int
-
Available on Duration, provided by the DurationExtensions extension
The number of whole weeks.no setter - isZero → bool
-
Available on Duration, provided by the DurationExtensions extension
Whether this is exactly zero.no setter
Methods
-
toClock(
) → String -
Available on Duration, provided by the DurationExtensions extension
Shows this as a clock, like01:02:05. -
toPretty(
) → String -
Available on Duration, provided by the DurationExtensions extension
Shows this as short readable text, like1h 30mor250ms.