formatQuotaAmount function

String formatQuotaAmount(
  1. double? value,
  2. QuotaUnit unit
)

Formats one amount: $48.20 / $150 / 1840. Currency keeps two decimals unless the value is integral.

Implementation

String formatQuotaAmount(double? value, QuotaUnit unit) {
  if (value == null) return '…';
  final String body;
  if (unit == QuotaUnit.currencyUsd) {
    body = _trimNumber(value, value % 1 == 0 ? 0 : 2);
    return '\$$body';
  }
  return _trimNumber(value, 0);
}