-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for raw key events on Fuchsia #6754
Conversation
/// If there is no unicode code point, this value is zero. | ||
final int codePoint; | ||
} | ||
|
||
/// Base class for raw key events. | ||
/// | ||
/// Raw key events pass through as much information as possible from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"makes they" on line 89 is grammatically dubious, while you're here...
@@ -110,6 +134,12 @@ RawKeyEvent _toRawKeyEvent(dynamic message) { | |||
metaState: message['metaState'] ?? 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before the switch, maybe in the argument type, assert that message is a Map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and that it contains a key 'keymap'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there's no keymap, it will hit the default case and throw an exception
hidUsage: message['hidUsage'] ?? 0, | ||
codePoint: message['codePoint'] ?? 0, | ||
); | ||
break; | ||
default: | ||
throw new FlutterError('Unknown keymap for key events: $keymap'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this avoid crashing on iOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't generate these messages on iOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment explaining this.
hidUsage: message['hidUsage'] ?? 0, | ||
codePoint: message['codePoint'] ?? 0, | ||
); | ||
break; | ||
default: | ||
throw new FlutterError('Unknown keymap for key events: $keymap'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just below here, assert that message has a 'type' key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this switch follow the pattern from the other switch, so you'll hit the default case and trigger an exception.
no tests? |
c2df287
to
386154e
Compare
386154e
to
fbe3fb2
Compare
See #6631