getTextForNumberLessThan100 method

String getTextForNumberLessThan100(
  1. int number
)

Implementation

String getTextForNumberLessThan100(int number) {
  if (number < 0 && number > 99) {
    throw ArgumentError('Number must be between 0 and 99');
  }

  final numberText = getNumberText(number);
  if (numberText != null) return numberText;

  final onesPlace = (number % 10).toInt();
  final onesPlaceText = getNumberText(onesPlace)!;

  final tensPlace = (number - onesPlace) % 100;
  final tensPlaceText = getNumberText(tensPlace)!;

  return mapper.combineLessThan100(onesPlaceText, tensPlaceText);
}