I would like to be able to simulate pressing the Escape key in a Flutter web application.
Any help would be valued.
I would like to be able to simulate pressing the Escape key in a Flutter web application.
Any help would be valued.
It is possible in integration tests. Check the docs. https://docs.flutter.dev/cookbook/testing/integration/introduction
You can try html.window.dispatchEvent() method inside a .dart file to achieve this.
import 'dart:html' as html;
html.window.dispatchEvent(new KeyboardEvent('keydown', { 'key': 'Escape' }));
References for keys - https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values