toKMB static method

String toKMB(
  1. int counter,
  2. String singularName,
  3. String pluralName, [
  4. Counter counterType = Counter.kmb,
])

Implementation

static String toKMB(
  int counter,
  String singularName,
  String pluralName, [
  Counter counterType = Counter.kmb,
]) {
  if (counter > 1) {
    switch (counterType) {
      case Counter.k:
        return "${Counter.toKCount(counter)} $pluralName";
      case Counter.km:
        return "${Counter.toKMCount(counter)} $pluralName";
      case Counter.kmb:
      default:
        return "${Counter.toKMBCount(counter)} $pluralName";
    }
  } else {
    return "$counter $singularName";
  }
}