HumanizedDuration extension
Extension on Duration to provide a human-readable string representation.
Converts a Duration into a formatted time string, such as 02:34 or 1:02:34,
depending on whether hours are present.
Example:
final duration = Duration(hours: 1, minutes: 2, seconds: 34);
print(duration.toHumanizedString()); // "1:02:34"
This is useful for displaying durations in UI elements like timers, media players, etc.
- on
Methods
-
toHumanizedString(
) → String -
Available on Duration, provided by the HumanizedDuration extension
Converts the Duration into a human-friendly string in the format: