toRupiah method
Converts the integer (assumed as monetary value) into Indonesian Rupiah format.
Example:
15000.toRupiah(); // "Rp15.000"
15000.toRupiah(usingSymbol: false); // "15.000"
If the integer is null, this will return "Rp0" or "0" depending on usingSymbol.
Implementation
String toRupiah({bool usingSymbol = true}) {
final formatter = NumberFormat.simpleCurrency(
locale: 'id_ID',
decimalDigits: 0,
);
final formattedRupiah = formatter.format(this ?? 0);
return usingSymbol ? formattedRupiah : formattedRupiah.replaceAll('Rp', '');
}