TimeFormatter class

Utility class for formatting time durations

Constructors

TimeFormatter()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

formatCountdown(Duration duration, {bool showMilliseconds = false}) String
Format duration for countdown display
formatCustom(Duration duration, String pattern) String
Format duration with custom pattern Pattern can contain: {h} for hours, {m} for minutes, {s} for seconds, {ms} for milliseconds
formatHHMMSS(Duration duration) String
Format duration as HH:MM:SS
formatMMSS(Duration duration) String
Format duration as MM:SS
formatShortWords(Duration duration) String
Format duration with short words (e.g., "2h 30m")
formatSmart(Duration duration) String
Smart format - automatically chooses the best format based on duration
formatSS(Duration duration) String
Format duration as SS (seconds only)
formatWithFullMilliseconds(Duration duration) String
Format duration with milliseconds as SS.MSS
formatWithMilliseconds(Duration duration) String
Format duration with milliseconds as SS.MS
formatWords(Duration duration) String
Format duration with words (e.g., "2 hours 30 minutes")
getFormatter({bool showHours = true, bool showMinutes = true, bool showSeconds = true, bool showMilliseconds = false, String? customPattern}) String Function(Duration)
Get the most appropriate format for a given duration