matches method

bool matches(
  1. Set<LogicalKeyboardKey> pressed
)

Check if the combo is active based on currently pressed modifiers

Implementation

bool matches(Set<LogicalKeyboardKey> pressed) {
  for (final mod in modifiers) {
    // resolve alias for ctrl and alt keys to handle left/right variants
    if (mod == ctrlKey) {
      if (!(pressed.contains(ctrlLeftKey) || pressed.contains(ctrlRightKey))) {
        return false;
      }
    } else if (mod == altKey) {
      if (!(pressed.contains(altLeftKey) || pressed.contains(altRightKey))) {
        return false;
      }
    } else {
      if (!pressed.contains(mod)) return false;
    }
  }
  return true;
}