getDisplayTime static method

String getDisplayTime(
  1. int value, {
  2. bool hours = true,
  3. bool minute = true,
  4. bool second = true,
  5. bool milliSecond = true,
  6. String hoursRightBreak = ':',
  7. String minuteRightBreak = ':',
  8. String secondRightBreak = '.',
})

Get display time.

Implementation

static String getDisplayTime(
  int value, {
  bool hours = true,
  bool minute = true,
  bool second = true,
  bool milliSecond = true,
  String hoursRightBreak = ':',
  String minuteRightBreak = ':',
  String secondRightBreak = '.',
}) {
  final hoursStr = getDisplayTimeHours(value);
  final mStr = getDisplayTimeMinute(value, hours: hours);
  final sStr = getDisplayTimeSecond(value);
  final msStr = getDisplayTimeMillisecond(value);
  var result = '';
  if (hours) {
    result += hoursStr;
  }
  if (minute) {
    if (hours) {
      result += hoursRightBreak;
    }
    result += mStr;
  }
  if (second) {
    if (minute) {
      result += minuteRightBreak;
    }
    result += sStr;
  }
  if (milliSecond) {
    if (second) {
      result += secondRightBreak;
    }
    result += msStr;
  }
  return result;
}