toCurrency method

String toCurrency([
  1. String? symbol
])

Currency formatter (e.g '2500.56' -> '$2,500.56').

Example:

final number = 2500.56;
final currency = number.toCurrency();
// returns: '$2,500.56'

Implementation

String toCurrency([String? symbol]) => toString().toCurrency(symbol ?? '\$');