formatQuotaUsedLimit function
Renders the used/limit column: unknown for a null quota (capability
absent or fetch failed — never a null literal, E2), unmetered for
billing-free providers, $48.20/$150 when both sides are known,
$48.20/no cap for uncapped prepaid, unlimited when nothing is
reported at all, …/$150 when only the limit is known.
Implementation
String formatQuotaUsedLimit(ProviderQuota? quota) {
if (quota == null) return 'unknown';
if (quota.isUnmetered || quota.unit == QuotaUnit.unmetered) return 'unmetered';
final used = formatQuotaAmount(quota.used, quota.unit);
final limit =
quota.limit == null ? null : formatQuotaAmount(quota.limit, quota.unit);
if (quota.used == null && limit == null) return 'unlimited';
if (limit == null) return '$used/no cap';
return '$used/$limit';
}