humanize property
String
get
humanize
This getter provides a human-readable string representation of a number.
Example:
int number = 1000000;
print(number.humanize); // Output: 1M
It uses the NumberFormat.compact() method to format the number in a compact way,
such as using abbreviations like "K" for thousands or "M" for millions.
Note: Make sure to import the necessary dependencies (e.g., import 'package:intl/intl.dart';) where you want to use this getter.
Implementation
String get humanize {
String formatedNumber = NumberFormat.compact().format(this);
return formatedNumber;
}