inUnit method

String inUnit(
  1. DurationTersity unit,
  2. int amount, [
  3. bool abbreviated = true
])

Implementation

String inUnit(DurationTersity unit, int amount, [bool abbreviated = true]) {
  switch (unit) {
    case DurationTersity.week:
      return week(amount, abbreviated);
    case DurationTersity.day:
      return day(amount, abbreviated);
    case DurationTersity.hour:
      return hour(amount, abbreviated);
    case DurationTersity.minute:
      return minute(amount, abbreviated);
    case DurationTersity.second:
      return second(amount, abbreviated);
    case DurationTersity.millisecond:
      return millisecond(amount, abbreviated);
    case DurationTersity.microsecond:
      return microseconds(amount, abbreviated);
    default:
      throw UnsupportedError('unsupported duration unit: $unit');
  }
}