INNER CODE UNIT · Dart
formatTime
jhomlala/feather · lib/src/utils/date_time_helper.dart:28
static String formatTime(int time) {
final int hours = (time / hoursAsMs).floor();
final int minutes = ((time - hours * hoursAsMs) / minutesAsMs).floor();
final int seconds =
((time - hours * hoursAsMs - minutes * minutesAsMs) / secondsAsMs)
.floor();
String text = "";
if (hours > 0) {
text += "${formatTimeUnit(hours)}h ";
}
if (minutes > 0) {
text += "${formatTimeUnit(minutes)}m ";
}
if (seconds >= 0) {
text += "${formatTimeUnit(seconds)}s";
}
return text;
}