Keyboard shortcuts - Flutter

With Flutter, you can use the RawKeyboard listener to implement shortcuts in your app. The RawKeyboard listener yields a RawKeyUpEvent of a RawKeyDownEvent. The data attribute has a isModifierPressed() method that can be used to determine whether a modifier key has been pressed.

RawKeyboard.instance.addListener((keyEvent) {
  if (keyEvent is RawKeyUpEvent) {
    if (keyEvent.logicalKey == LogicalKeyboardKey.keyF &&
        keyEvent.data.isModifierPressed(ModifierKey.controlModifier)) {
      find();
    }
  }
});

void find() {
    // Logic
}