sendKeyDownEvent method

Future<void> sendKeyDownEvent (LogicalKeyboardKey key, { String platform: 'android' })

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

This only simulates key down events 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 "android". Must not be null. 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:

  • sendKeyUpEvent to simulate the corresponding key up event.
  • sendKeyEvent to simulate both the key up and key down in the same call.

Implementation

Future<void> sendKeyDownEvent(LogicalKeyboardKey key, { String platform = 'android' }) async {
  assert(platform != null);
  // Internally wrapped in async guard.
  return simulateKeyDownEvent(key, platform: platform);
}