KeyCode class abstract

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.

Constructors

KeyCode()

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

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.).

Constants

A → const int
65
ALT → const int
18
APOSTROPHE → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
192
B → const int
66
BACKSLASH → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
220
BACKSPACE → const int
8
C → const int
67
CAPS_LOCK → const int
20
CLOSE_SQUARE_BRACKET → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
221
COMMA → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
188
CONTEXT_MENU → const int
93
CTRL → const int
17
D → const int
68
DASH → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
189
DELETE → const int
46
DOWN → const int
40
E → const int
69
EIGHT → const int
56
END → const int
35
ENTER → const int
13
EQUALS → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
187
ESC → const int
27
F → const int
70
F1 → const int
112
F2 → const int
113
F3 → const int
114
F4 → const int
115
F5 → const int
116
F6 → const int
117
F7 → const int
118
F8 → const int
119
F9 → const int
120
F10 → const int
121
F11 → const int
122
F12 → const int
123
FF_EQUALS → const int
61
FF_SEMICOLON → const int
59
FIRST_MEDIA_KEY → const int
166
FIVE → const int
53
FOUR → const int
52
G → const int
71
H → const int
72
HOME → const int
36
I → const int
73
INSERT → const int
45
J → const int
74
K → const int
75
L → const int
76
LAST_MEDIA_KEY → const int
183
LEFT → const int
37
M → const int
77
MAC_ENTER → const int
3
MAC_FF_META → const int
224
META → const int
91
N → const int
78
NINE → const int
57
NUM_CENTER → const int
NUM_CENTER is also NUMLOCK for FF and Safari on Mac.
12
NUM_DELETE → const int
46
NUM_DIVISION → const int
111
NUM_EAST → const int
39
NUM_EIGHT → const int
104
NUM_FIVE → const int
101
NUM_FOUR → const int
100
NUM_INSERT → const int
45
NUM_MINUS → const int
109
NUM_MULTIPLY → const int
106
NUM_NINE → const int
105
NUM_NORTH → const int
38
NUM_NORTH_EAST → const int
33
NUM_NORTH_WEST → const int
36
NUM_ONE → const int
97
NUM_PERIOD → const int
110
NUM_PLUS → const int
107
NUM_SEVEN → const int
103
NUM_SIX → const int
102
NUM_SOUTH → const int
40
NUM_SOUTH_EAST → const int
34
NUM_SOUTH_WEST → const int
35
NUM_THREE → const int
99
NUM_TWO → const int
98
NUM_WEST → const int
37
NUM_ZERO → const int
96
NUMLOCK → const int
144
O → const int
79
ONE → const int
49
OPEN_SQUARE_BRACKET → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
219
P → const int
80
PAGE_DOWN → const int
34
PAGE_UP → const int
33
PAUSE → const int
19
PERIOD → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
190
44
Q → const int
81
QUESTION_MARK → const int
CAUTION: The question mark is for US-keyboard layouts. It varies for other locales and keyboard layouts.
63
R → const int
82
39
S → const int
83
SCROLL_LOCK → const int
145
SEMICOLON → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
186
SEVEN → const int
55
SHIFT → const int
16
SINGLE_QUOTE → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
222
SIX → const int
54
SLASH → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
191
SPACE → const int
32
T → const int
84
TAB → const int
9
THREE → const int
51
TILDE → const int
CAUTION: This constant requires localization for other locales and keyboard layouts.
192
TWO → const int
50
U → const int
85
UNKNOWN → const int
A sentinel value if the keycode could not be determined.
-1
UP → const int
38
V → const int
86
W → const int
87
WIN_IME → const int
229
WIN_KEY → const int
224
WIN_KEY_FF_LINUX → const int
0
WIN_KEY_LEFT → const int
91
WIN_KEY_RIGHT → const int
92
X → const int
88
Y → const int
89
Z → const int
90
ZERO → const int
48