toHMS method

String toHMS()

Prints a Duration with the format {hh:mm:ss}.

Implementation

String toHMS() {
  String twoDigits(int n) => n.toString().padLeft(2, "0");

  final String twoDigitMinutes = twoDigits(inMinutes.remainder(60));
  final String twoDigitSeconds = twoDigits(inSeconds.remainder(60));

  return "${twoDigits(inHours)}:$twoDigitMinutes:$twoDigitSeconds";
}