toBlock static method

List<DVAccelerator> toBlock(
  1. DVKioskPolicy policy
)

What policy blocks: the combos, less the exempt, when the policy blocks hardware keys or shortcuts -- device scope by default, display scope only when asked, and then device-wide because keys are a device.

Implementation

static List<DVAccelerator> toBlock(DVKioskPolicy policy) {
  if (!policy.enabled) return const <DVAccelerator>[];
  if (!policy.blockHardwareKeys && !policy.blockShortcuts) {
    return const <DVAccelerator>[];
  }
  if (policy.scope == DVKioskScope.display && !policy.blockHardwareKeys) {
    return const <DVAccelerator>[];
  }
  return <DVAccelerator>[
    for (final DVAccelerator c in combos)
      if (!DVAccessibilityKeys.isExempt(logical(c))) c,
  ];
}