replaceFarsiNumber function Null safety

String replaceFarsiNumber(
  1. String input
)

Implementation

String replaceFarsiNumber(String input) {
  final english = '0123456789'.split('').map((e) => e.trim()).toList();
  final farsi = '٠١٢٣٤٥٦٧٨٩'.split('').map((e) => e.trim()).toList();
  var result = input;

  for (int i = 0; i < english.length; i++) {
    result = result.replaceAll(farsi[i], english[i]);
  }

  return result;
}