OutboxQueueStatusCard constructor

OutboxQueueStatusCard({
  1. Key? key,
  2. required int pendingCount,
  3. required int manualReviewCount,
  4. required OutboxQueueStatus status,
  5. bool busy = false,
  6. Future<void> onDrain()?,
  7. String title = 'Offline delivery queue',
  8. String idleLabel = 'Waiting to sync',
  9. String drainingLabel = 'Syncing queued changes',
  10. String offlineLabel = 'Offline · changes stay on this device',
  11. String errorLabel = 'Sync could not finish. Try again later.',
  12. String pendingLabel = 'Pending',
  13. String reviewLabel = 'Needs review',
  14. String drainLabel = 'Sync now',
})

Implementation

OutboxQueueStatusCard({
  super.key,
  required this.pendingCount,
  required this.manualReviewCount,
  required this.status,
  this.busy = false,
  this.onDrain,
  this.title = 'Offline delivery queue',
  this.idleLabel = 'Waiting to sync',
  this.drainingLabel = 'Syncing queued changes',
  this.offlineLabel = 'Offline · changes stay on this device',
  this.errorLabel = 'Sync could not finish. Try again later.',
  this.pendingLabel = 'Pending',
  this.reviewLabel = 'Needs review',
  this.drainLabel = 'Sync now',
}) {
  if (pendingCount < 0) {
    throw ArgumentError.value(pendingCount, 'pendingCount', 'must be >= 0');
  }
  if (manualReviewCount < 0) {
    throw ArgumentError.value(
      manualReviewCount,
      'manualReviewCount',
      'must be >= 0',
    );
  }
  for (final (name, value) in [
    ('title', title),
    ('idleLabel', idleLabel),
    ('drainingLabel', drainingLabel),
    ('offlineLabel', offlineLabel),
    ('errorLabel', errorLabel),
    ('pendingLabel', pendingLabel),
    ('reviewLabel', reviewLabel),
    ('drainLabel', drainLabel),
  ]) {
    if (value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}