import 'package:intl/intl.dart'; /// Formats a payroll amount in the organisation's currency. /// /// [currency] is the ISO 4217 code the server sends on payslips / profile /// (`currency`). Missing or blank ⇒ INR, which keeps the original output: /// rupee sign, Indian lakh grouping, no decimals (e.g. `₹1,23,457`). /// Other currencies print the ISO code and the currency's own minor units /// (e.g. `AED 12,345.50`, `BHD 1,234.500`). String formatMoney(num v, [String? currency]) { final code = (currency ?? '').trim().toUpperCase(); if (code.isEmpty || code == 'INR') { return '₹${NumberFormat('#,##,###').format(v)}'; } // NumberFormat.currency picks the ISO default fraction digits for `name` // (BHD/KWD/OMR 3, JPY 0, most others 2). return NumberFormat.currency(locale: 'en', name: code, symbol: '$code ').format(v); }