please need to under stand why using to int in this function class MyFunctions { static String convertNumber(String number, String lang) { print("*" * 50); print(number); String res = ""; final arabicsNum = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']; if (lang == "ar") { number.split("").forEach((element) { print(element);//String number if (element == ".") { res += "."; } else { res += arabicsNum[int.parse(element).toInt()]; } }); } else { res = number; } return res; }
you save my life Broo..
thank you,
really usefull.
Thanks man. good job
Very nice useful video
How can I convert any data type to string in flutter?
just add .toString() at the end of it
@@FlutterMentor Thanks for your response really appreciate it
are you going to make some tutorial (weather app etc.)?
Yeah I'll try to get that done in 2022
tryParse didn´t work, only Parse did
Exception has occurred.
FormatException (FormatException: Invalid double
)
please need to under stand why using to int in this function
class MyFunctions {
static String convertNumber(String number, String lang) {
print("*" * 50);
print(number);
String res = "";
final arabicsNum = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
if (lang == "ar") {
number.split("").forEach((element) {
print(element);//String number
if (element == ".") {
res += ".";
} else {
res += arabicsNum[int.parse(element).toInt()];
}
});
} else {
res = number;
}
return res;
}