isApproachingQuota static method

bool isApproachingQuota(
  1. ByteConverter currentUsage, {
  2. required ByteConverter quota,
  3. double warningThreshold = 0.8,
})

Checks if currentUsage exceeds warningThreshold of quota.

warningThreshold should be between 0.0 and 1.0 (e.g., 0.8 for 80%).

Implementation

static bool isApproachingQuota(
  ByteConverter currentUsage, {
  required ByteConverter quota,
  double warningThreshold = 0.8,
}) {
  if (quota.bytes == 0) return true;
  return (currentUsage.bytes / quota.bytes) >= warningThreshold;
}