thousandsTrillions method

String thousandsTrillions(
  1. dynamic one,
  2. dynamic two,
  3. dynamic three,
  4. dynamic eleven,
  5. dynamic diff,
  6. dynamic number,
  7. dynamic other,
)

Implementation

String thousandsTrillions(one, two, three, eleven, diff, number, other) {
  other = int.parse(other);
  other = NumberArabic.convert('$other');

  if (other == "") {
    other = "صفر";
  }

  var value = "";

  number = int.parse('$number');

  if ('$number'.length == 4 + diff) {
    var ones = int.parse(getNth(number, 0, 0));
    switch (ones) {
      case 1:
        value = one + " و" + (other);
        break;
      case 2:
        value = two + " و" + (other);
        break;
      default:
        value = "${oneTen(ones) + " " + three} و" + (other);
        break;
    }
  } else if ('$number'.length == 5 + diff) {
    var tens = int.parse(getNth(number, 0, 1));
    switch (tens) {
      case 10:
        value = "${oneTen(tens) + " " + three} و" + (other);
        break;
      default:
        value = "${oneTen(tens) + " " + eleven} و" + (other);
        break;
    }
  } else if ('$number'.length == 6 + diff) {
    var hundreds = int.parse(getNth(number, 0, 2));
    var tens = int.parse(getNth(number, 0, 1));

    var two = int.parse(getNth(number, 1, 2));
    var th = "";
    switch (two) {
      case 0:
        th = one;
        break;

      default:
        th = eleven;
        break;
    }
    if (100 <= tens && tens <= 199) {
      value = "${hundred(hundreds)} $th و" + (other);
    } else if (200 <= tens && tens <= 299) {
      value = "${hundred(hundreds)} $th و" + (other);
    } else {
      value = "${hundred(hundreds)} $th و" + (other);
    }
  }

  return value;
}