Issue
I know event.type
in DOM. I can parse for example mouseup
, keydown
, touchstart
and so on. But how can I check for the event subclass? Like MouseEvent
, AnimationEvent
or ClipboardEvent
? Can I use the event.type
property?
Solution
You can check the class like
void myHandler(Event e) {
if(e is MouseEvent) {
print('Mouse');
} else if(e is AnimationEvent) {
print('Animation');
} else if(e is KeyboardEvent) {
print('Keyboard');
}
}
Answered By – Günter Zöchbauer
Answer Checked By – David Marino (FlutterFixes Volunteer)