ConnectivityStatusCard constructor
ConnectivityStatusCard({
- Key? key,
- required ConnectivityCardState state,
- required int queuedCount,
- Future<
void> onRetry()?, - bool busy = false,
- String title = 'Connection',
- String offlineLabel = 'Offline',
- String checkingLabel = 'Checking connection',
- String onlineLabel = 'Online',
- String degradedLabel = 'Connection unstable',
- String queuedLabel = 'Waiting tasks',
- String automaticDrainNote = 'Waiting tasks run automatically when back online.',
- String retryLabel = 'Retry connection check',
- 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');
}
}
}