Text(
'${NumberFormat.compactSimpleCurrency(
decimalDigits: 0).format(docSnap['count'])} searches',
Can you help me how to convert number for example 10,000 to 10K but without currency sign like $ or etc. it is because i just want to show only 10k instead of $10k
CodePudding user response:
Install the intl package
-->
https://pub.dev/packages/intl
Create custom function like this,
String formatNumber(int number) {
return NumberFormat.compact().format(number);
}
Call the formatNumber
function when you want it.
How to use this with Text Widget,
int number = 100000; // Variable
Text(formatNumber(number),) // call the function inside Text widget