getDurationText method

String getDurationText(
  1. Duration duration
)

Implementation

String getDurationText(Duration duration) {
  if (duration.inSeconds == 0) return '';
  if (duration.isNegative) return '';
  if (duration.inMinutes < 1) {
    return '•  ${duration.inSeconds}${viewer!.customizer.seconds}';
  } else if (duration.inMinutes < 60) {
    return '•  ${duration.inMinutes}${viewer!.customizer.minutes}';
  } else if (duration.inHours < 24) {
    return '•  ${duration.inHours}${viewer!.customizer.hours}';
  } else if (duration.inDays < 7) {
    return '•  ${duration.inDays}${viewer!.customizer.days}';
  } else {
    return '•  ${duration.inDays ~/ 7}${viewer!.customizer.weeks}';
  }
}