formatTime property
String
get
formatTime
Format time "hr:min:sec"
Implementation
String get formatTime {
if (isNegative) return "$this";
int hours = (this / 3600).floor();
int minutes = ((this % 3600) / 60).floor();
int seconds = (this % 60);
String hoursStr = (hours % 24).toString().padLeft(2, '0');
String minutesStr = minutes.toString().padLeft(2, '0');
String secondsStr = seconds.toString().padLeft(2, '0');
return '$hoursStr:$minutesStr:$secondsStr';
}