cents static method

String cents(
  1. num? centsVal, [
  2. int decimals = 2,
  3. String symbol = "\$"
])

Formats cents value into currency representation.

Implementation

static String cents(num? centsVal, [int decimals = 2, String symbol = "\$"]) {
  if (centsVal == null) return "";
  if (centsVal <= 0) return symbol + (0.0).toStringAsFixed(decimals);
  return symbol + (centsVal / 100).toStringAsFixed(decimals);
}