getAutoTimeLabel method

String getAutoTimeLabel({
  1. String hourLable = 'h',
  2. String minutesLable = 'm',
  3. String secondsLable = 's',
  4. String miliSecondsLable = 'ms',
})

Implementation

String getAutoTimeLabel({
  String hourLable = 'h',
  String minutesLable = 'm',
  String secondsLable = 's',
  String miliSecondsLable = 'ms',
}) {
  if (inMinutes > 60) {
    return '$inHours $hourLable';
  }
  if (inSeconds > 60) {
    return '$inMinutes $minutesLable';
  }
  if (inMilliseconds >= 1000) {
    return '$inSeconds $secondsLable';
  }

  return '$inMilliseconds $miliSecondsLable';
}