RemoteKillSwitchPanel constructor
RemoteKillSwitchPanel({
- Key? key,
- required List<
KillSwitchItem> items, - required Future<
void> onKillLocally(- String id
- required Future<
void> onClearOverride(- String id
- bool busy = false,
- String title = 'Feature safety switches',
- String killedLabel = 'Killed',
- String activeLabel = 'Active',
- String killLabel = 'Kill locally',
- String confirmKillLabel = 'Confirm local kill',
- String clearLabel = 'Clear local override',
- String confirmationText = 'This only kills the feature on this device. It cannot enable a remotely killed feature.',
- String cancelLabel = 'Cancel',
- String errorLabel = 'Could not apply this change. Please try again.',
- String emptyLabel = 'No feature switches.',
Implementation
RemoteKillSwitchPanel({
super.key,
required List<KillSwitchItem> items,
required this.onKillLocally,
required this.onClearOverride,
this.busy = false,
this.title = 'Feature safety switches',
this.killedLabel = 'Killed',
this.activeLabel = 'Active',
this.killLabel = 'Kill locally',
this.confirmKillLabel = 'Confirm local kill',
this.clearLabel = 'Clear local override',
this.confirmationText =
'This only kills the feature on this device. It cannot enable a remotely killed feature.',
this.cancelLabel = 'Cancel',
this.errorLabel = 'Could not apply this change. Please try again.',
this.emptyLabel = 'No feature switches.',
}) : items = List.unmodifiable(items) {
final ids = <String>{};
for (final item in items) {
if (!ids.add(item.id)) {
throw ArgumentError.value(item.id, 'items', 'duplicate id');
}
}
for (final (name, value) in [
('title', title),
('killedLabel', killedLabel),
('activeLabel', activeLabel),
('killLabel', killLabel),
('confirmKillLabel', confirmKillLabel),
('clearLabel', clearLabel),
('confirmationText', confirmationText),
('cancelLabel', cancelLabel),
('errorLabel', errorLabel),
('emptyLabel', emptyLabel),
]) {
if (value.trim().isEmpty) {
throw ArgumentError.value(value, name, 'must not be blank');
}
}
}