Flutter MacOS get LogicalKeyboardKey for CMD

Viewed 440

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.

1 Answers

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.

Related