Flutter MacOS get LogicalKeyboardKey for CMD

234

After digging through the source code and using RawKeyboardListener to examine the "opaque" code of the CMD key, I discovered that LogicalKeyboard key does have a key for cmd which is LogicalKeyboardKey.meta.

Share:
234
Wilson Wilson
Author by

Wilson Wilson

Freelance Flutter developer. I occasionally dream in Dart.

Updated on December 26, 2022

Comments

  • Wilson Wilson
    Wilson Wilson over 1 year

    I'm building an app that heavily relies on keybindings. Right now, Flutter supports a ton of keybindings, and declaring a LogicalKeySet is very simple:

     final exampleKeySet = LogicalKeySet(
        LogicalKeyboardKey.control,
        LogicalKeyboardKey.comma,
      );
    

    The LogicalKeyboardKey has a value for almost every key on the keyboard including the Ctrl and Alt Keys. But there is no option for a Command key on Mac.

    How can I use the Command key with LogicalKeySet.