keyLabel property

String keyLabel

The Unicode string representing the character produced by a RawKeyEvent.

This value is useful for describing or matching mnemonic keyboard shortcuts.

On most platforms this is a single code point, but it could contain any Unicode string. The keyLabel differs from RawKeyEvent.character because keyLabel only takes into account the key being pressed, not any combining keys pressed before it, so, for example, an “o” that follows a combining dieresis (“¨”, COMBINING DIAERESIS (U+0308)) would just return “o” for keyLabel, but would return “ö” for RawKeyEvent.character.

Do not use the keyLabel to compose a text string: it will be missing special processing for Unicode strings for combining characters and other special characters, and the effects of modifiers.

If you are looking for the character produced by a key event, use RawKeyEvent.character instead.

If you are composing text strings, use the TextField or CupertinoTextField widgets, since those automatically handle many of the complexities of managing keyboard input, like showing a soft keyboard or interacting with an input method editor (IME).


final String keyLabel