CloudSaveStatusCard constructor

CloudSaveStatusCard({
  1. Key? key,
  2. required CloudSaveStatus status,
  3. int pendingCount = 0,
  4. String? lastSyncText,
  5. Future<void> onSync()?,
  6. bool busy = false,
  7. String title = 'Cloud save',
  8. String readyLabel = 'Ready to sync',
  9. String syncingLabel = 'Syncing',
  10. String syncedLabel = 'Synced',
  11. String offlineLabel = 'Offline',
  12. String errorLabel = 'Sync failed. Try again.',
  13. String pendingLabel = 'Pending changes',
  14. String syncLabel = 'Sync now',
  15. String retryLabel = 'Retry sync',
})

Implementation

CloudSaveStatusCard({
  super.key,
  required this.status,
  this.pendingCount = 0,
  this.lastSyncText,
  this.onSync,
  this.busy = false,
  this.title = 'Cloud save',
  this.readyLabel = 'Ready to sync',
  this.syncingLabel = 'Syncing',
  this.syncedLabel = 'Synced',
  this.offlineLabel = 'Offline',
  this.errorLabel = 'Sync failed. Try again.',
  this.pendingLabel = 'Pending changes',
  this.syncLabel = 'Sync now',
  this.retryLabel = 'Retry sync',
}) {
  if (pendingCount < 0) {
    throw ArgumentError.value(pendingCount, 'pendingCount', 'must be >= 0');
  }
  for (final (name, value) in [
    ('title', title),
    ('readyLabel', readyLabel),
    ('syncingLabel', syncingLabel),
    ('syncedLabel', syncedLabel),
    ('offlineLabel', offlineLabel),
    ('errorLabel', errorLabel),
    ('pendingLabel', pendingLabel),
    ('syncLabel', syncLabel),
    ('retryLabel', retryLabel),
    ('lastSyncText', lastSyncText),
  ]) {
    if (value != null && value.trim().isEmpty) {
      throw ArgumentError.value(value, name, 'must not be blank');
    }
  }
}