num2Persian function

String num2Persian(
  1. String number
)

Implementation

String num2Persian(String number) {
  if (int.parse(number) == 0) {
    return zero;
  }
  if (number.length > 18) {
    return 'خارج از محدوده';
  }
  List<String> spitedNumber = prepareNumber(number);
  List<String> output = [];
  int splitLength = spitedNumber.length;
  for (int i = 0; i < splitLength; i++) {
    String sectionTitle = letters[4][splitLength - (i + 1)];
    String converted = threeNumbersToLetter(spitedNumber[i]);
    if (converted.isNotEmpty) {
      output.add('$converted$sectionTitle');
    }
  }
  return output.join(delimiter);
}