simulateKeyDownEvent function

Future<void> simulateKeyDownEvent (
  1. LogicalKeyboardKey key,
  2. {String platform}
)

Simulates sending a hardware key down event through the system channel.

This only simulates key presses coming from a physical keyboard, not from a soft keyboard.

Specify platform as one of the platforms allowed in Platform.operatingSystem to make the event appear to be from that type of system. Defaults to the operating system that the test is running on. Some platforms (e.g. Windows, iOS) are not yet supported.

Keys that are down when the test completes are cleared after each test.

See also:

Implementation

Future<void> simulateKeyDownEvent(LogicalKeyboardKey key, {String platform}) {
  return KeyEventSimulator.simulateKeyDownEvent(key, platform: platform);
}