formatTimeToHrMin property

String get formatTimeToHrMin

Format time "hr:min or min"

Implementation

String get formatTimeToHrMin {
  if (isNegative) return "$this";
  int hours = (this / 3600).floor();
  int minutes = ((this % 3600) / 60).floor();

  String hoursStr = (hours % 24).toString().padLeft(2, '0');
  String minutesStr = minutes.toString().padLeft(2, '0');

  return '${hours > 0 ? "$hoursStr hrs " : ""}$minutesStr mins ';
}