sendKeyRepeatEvent method

Future<bool> sendKeyRepeatEvent(
  1. LogicalKeyboardKey key,
  2. {String platform = _defaultPlatform,
  3. String? character,
  4. PhysicalKeyboardKey? physicalKey}
)

Simulates sending a key repeat event from a physical keyboard.

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

Specify platform as one of the platforms allowed in platform.Platform.operatingSystem to make the event appear to be from that type of system. Defaults to "web" on web, and "android" everywhere else. Must not be null.

Specify the physicalKey for the event to override what is included in the simulated event. If not specified, it uses a default from the US keyboard layout for the corresponding logical key.

Specify the character for the event to override what is included in the simulated event. If not specified, it uses a default derived from the logical key.

Whether the event is sent through RawKeyEvent or KeyEvent is controlled by debugKeyEventSimulatorTransitModeOverride. If through RawKeyEvent, this method is equivalent to sendKeyDownEvent.

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

Returns true if the key event was handled by the framework.

See also:

Implementation

Future<bool> sendKeyRepeatEvent(
    LogicalKeyboardKey key, {
      String platform = _defaultPlatform,
      String? character,
      PhysicalKeyboardKey? physicalKey
    }) async {
  // Internally wrapped in async guard.
  return simulateKeyRepeatEvent(key, platform: platform, character: character, physicalKey: physicalKey);
}