ConnectivityStatusCard constructor

ConnectivityStatusCard({
  1. Key? key,
  2. required ConnectivityCardState state,
  3. required int queuedCount,
  4. Future<void> onRetry()?,
  5. bool busy = false,
  6. String title = 'Connection',
  7. String offlineLabel = 'Offline',
  8. String checkingLabel = 'Checking connection',
  9. String onlineLabel = 'Online',
  10. String degradedLabel = 'Connection unstable',
  11. String queuedLabel = 'Waiting tasks',
  12. String automaticDrainNote = 'Waiting tasks run automatically when back online.',
  13. String retryLabel = 'Retry connection check',
  14. String errorLabel = 'Retry failed. Try again.',
})

Implementation

ConnectivityStatusCard({
  super.key,
  required this.state,
  required this.queuedCount,
  this.onRetry,
  this.busy = false,
  this.title = 'Connection',
  this.offlineLabel = 'Offline',
  this.checkingLabel = 'Checking connection',
  this.onlineLabel = 'Online',
  this.degradedLabel = 'Connection unstable',
  this.queuedLabel = 'Waiting tasks',
  this.automaticDrainNote =
      'Waiting tasks run automatically when back online.',
  this.retryLabel = 'Retry connection check',
  this.errorLabel = 'Retry failed. Try again.',
}) {
  if (queuedCount < 0) {
    throw ArgumentError.value(queuedCount, 'queuedCount', 'must be >= 0');
  }
  for (final (name, value) in [
    ('title', title),
    ('offlineLabel', offlineLabel),
    ('checkingLabel', checkingLabel),
    ('onlineLabel', onlineLabel),
    ('degradedLabel', degradedLabel),
    ('queuedLabel', queuedLabel),
    ('automaticDrainNote', automaticDrainNote),
    ('retryLabel', retryLabel),
    ('errorLabel', errorLabel),
  ]) {
    if (value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}