addHotKey method

void addHotKey(
  1. TappyKeyboardHotKey key
)

Register a new hot-key combination

Implementation

void addHotKey(TappyKeyboardHotKey key) {
  assert(
    key.modifiers.length >= 2,
    "Hot key must have at least two modifiers.",
  );
  final code = generateKeyCode(
    key.modifiers,
    isSequenceHotKeys,
  );
  if (_hotKeys.containsKey(code)) {
    throw TappyKeyboardHotKeyException(key, "Already configured!");
  }
  _hotKeys[code] = key;
  _maxKeyCombinations = max(_maxKeyCombinations, key.modifiers.length);
}