toClock method

String toClock()

"HH:MM:SS", or "MM:SS" under an hour. 90 s → "01:30"

Implementation

String toClock() {
  final int h = inHours;
  final int m = inMinutes % 60;
  final int s = inSeconds % 60;
  return h > 0 ? "${h.twoDigits}:${m.twoDigits}:${s.twoDigits}" : "${m.twoDigits}:${s.twoDigits}";
}