Defines the keycode values for keys that are returned by KeyboardEvent.keyCode.

Important note: There is substantial divergence in how different browsers handle keycodes and their variants in different locales/keyboard layouts. We provide these constants to help make code processing keys more readable.

Constants

A → int

const 65
ALT → int

const 18
APOSTROPHE → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 192
B → int

const 66
BACKSLASH → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 220
BACKSPACE → int

const 8
C → int

const 67
CAPS_LOCK → int

const 20
CLOSE_SQUARE_BRACKET → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 221
COMMA → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 188
CONTEXT_MENU → int

const 93
CTRL → int

const 17
D → int

const 68
DASH → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 189
DELETE → int

const 46
DOWN → int

const 40
E → int

const 69
EIGHT → int

const 56
END → int

const 35
ENTER → int

const 13
EQUALS → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 187
ESC → int

const 27
F → int

const 70
F1 → int

const 112
F2 → int

const 113
F3 → int

const 114
F4 → int

const 115
F5 → int

const 116
F6 → int

const 117
F7 → int

const 118
F8 → int

const 119
F9 → int

const 120
F10 → int

const 121
F11 → int

const 122
F12 → int

const 123
FF_EQUALS → int

const 61
FF_SEMICOLON → int

const 59
FIRST_MEDIA_KEY → int

const 166
FIVE → int

const 53
FOUR → int

const 52
G → int

const 71
H → int

const 72
HOME → int

const 36
I → int

const 73
INSERT → int

const 45
J → int

const 74
K → int

const 75
L → int

const 76
LAST_MEDIA_KEY → int

const 183
LEFT → int

const 37
M → int

const 77
MAC_ENTER → int

const 3
MAC_FF_META → int

const 224
META → int

const 91
N → int

const 78
NINE → int

const 57
NUM_CENTER → int

NUM_CENTER is also NUMLOCK for FF and Safari on Mac.

const 12
NUM_DELETE → int

const 46
NUM_DIVISION → int

const 111
NUM_EAST → int

const 39
NUM_EIGHT → int

const 104
NUM_FIVE → int

const 101
NUM_FOUR → int

const 100
NUM_INSERT → int

const 45
NUM_MINUS → int

const 109
NUM_MULTIPLY → int

const 106
NUM_NINE → int

const 105
NUM_NORTH → int

const 38
NUM_NORTH_EAST → int

const 33
NUM_NORTH_WEST → int

const 36
NUM_ONE → int

const 97
NUM_PERIOD → int

const 110
NUM_PLUS → int

const 107
NUM_SEVEN → int

const 103
NUM_SIX → int

const 102
NUM_SOUTH → int

const 40
NUM_SOUTH_EAST → int

const 34
NUM_SOUTH_WEST → int

const 35
NUM_THREE → int

const 99
NUM_TWO → int

const 98
NUM_WEST → int

const 37
NUM_ZERO → int

const 96
NUMLOCK → int

const 144
O → int

const 79
ONE → int

const 49
OPEN_SQUARE_BRACKET → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 219
P → int

const 80
PAGE_DOWN → int

const 34
PAGE_UP → int

const 33
PAUSE → int

const 19
PERIOD → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 190

const 44
Q → int

const 81
QUESTION_MARK → int

CAUTION: The question mark is for US-keyboard layouts. It varies for other locales and keyboard layouts.

const 63
R → int

const 82

const 39
S → int

const 83
SCROLL_LOCK → int

const 145
SEMICOLON → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 186
SEVEN → int

const 55
SHIFT → int

const 16
SINGLE_QUOTE → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 222
SIX → int

const 54
SLASH → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 191
SPACE → int

const 32
T → int

const 84
TAB → int

const 9
THREE → int

const 51
TILDE → int

CAUTION: This constant requires localization for other locales and keyboard layouts.

const 192
TWO → int

const 50
U → int

const 85
UNKNOWN → int

A sentinel value if the keycode could not be determined.

const -1
UP → int

const 38
V → int

const 86
W → int

const 87
WIN_IME → int

const 229
WIN_KEY → int

const 224
WIN_KEY_FF_LINUX → int

const 0
WIN_KEY_LEFT → int

const 91
WIN_KEY_RIGHT → int

const 92
X → int

const 88
Y → int

const 89
Z → int

const 90
ZERO → int

const 48

Static Methods

isCharacterKey(int keyCode) → bool

Returns true if the keyCode produces a (US keyboard) character. Note: This does not (yet) cover characters on non-US keyboards (Russian, Hebrew, etc.).

Constructors

KeyCode()

Properties

hashCode → int

Get a hash code for this object.…

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) → bool

The equality operator.…

inherited

Methods

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.…

inherited
toString() → String

Returns a string representation of this object.

inherited