toRialString function

String toRialString(
  1. String s, {
  2. bool fromToman = false,
})

Implementation

String toRialString(String s, {bool fromToman = false}) {
  s = digitToEnglish(s);
  if (int.tryParse(s) == null || int.parse(s).isNegative) {
    throw Exception('$s is invalid.');
  }
  if (fromToman) s = '${s}0';
  s = digitToFarsiString(s);
  return '$s ریال';
}