I have formatted 500000 to 500k using Number formatter like this
NumberFormat.compact().format(int.parse(player.price!))
but i want to convert the number to half million like this 0.5m
is it possible ?
I have formatted 500000 to 500k using Number formatter like this
NumberFormat.compact().format(int.parse(player.price!))
but i want to convert the number to half million like this 0.5m
is it possible ?
5
Answers
Just divide by
1000000
The output is
this function below returns you the result you want:
output:
as you know if you want to have another formats you have to customize it.
I think you are iranian.
these codes at below can be useful for you to change any numbers to text:
output:
happy coding…