DurationHelpers extension

on

Properties

inDays → int

Available on Duration, provided by the DurationHelpers extension

Converts this Duration to days
no setter
inHours → int

Available on Duration, provided by the DurationHelpers extension

Converts this Duration to hours
no setter
inMilliseconds → int

Available on Duration, provided by the DurationHelpers extension

Converts this Duration to milliseconds (already exists in core, but for chaining clarity)
no setter
inMinutes → int

Available on Duration, provided by the DurationHelpers extension

Converts this Duration to minutes
no setter
inSeconds → int

Available on Duration, provided by the DurationHelpers extension

Converts this Duration to seconds (already exists in core, but for chaining clarity)
no setter
isNegative → bool

Available on Duration, provided by the DurationHelpers extension

Check if this duration is negative
no setter
isZero → bool

Available on Duration, provided by the DurationHelpers extension

Check if this duration is zero
no setter
readable → String

Available on Duration, provided by the DurationHelpers extension

Returns a human-readable string, e.g., "2h 30m 15s"
no setter

Methods

chunked(Duration chunkSize) → List<Duration>

Available on Duration, provided by the DurationHelpers extension

Divide this duration into smaller chunks of given chunkSize Example: 5.seconds.chunked(1.seconds) => 1s, 1s, 1s, 1s, 1s
debounce(VoidCallback action) → void

Available on Duration, provided by the DurationHelpers extension

isEqualTo(Duration other) → bool

Available on Duration, provided by the DurationHelpers extension

isLongerThan(Duration other) → bool

Available on Duration, provided by the DurationHelpers extension

isShorterThan(Duration other) → bool

Available on Duration, provided by the DurationHelpers extension

Compare two durations
sleep() → Future<void>

Available on Duration, provided by the DurationHelpers extension

Delay for this duration (inline usage like: 2.seconds.sleep())
throttle(VoidCallback action) → void

Available on Duration, provided by the DurationHelpers extension

Operators

operator +(Duration other) → Duration

Available on Duration, provided by the DurationHelpers extension

Add two durations together (handy for chaining)
operator -(Duration other) → Duration

Available on Duration, provided by the DurationHelpers extension

Subtract two durations (also handy for chaining)