-
Notifications
You must be signed in to change notification settings - Fork 0
3. Keyboard
ROG edited this page Jul 25, 2022
·
2 revisions
Use Keyboard
to simulate keystrokes.
class Keyboard
This example shows a key being pressed.
Keyboard keyboard = Keyboard();
keyboard.press(KeyboardKey.ENTER);
This example shows a key being pressed multiple times until the Duration
runs out.
Keyboard keyboard = Keyboard();
await keyboard.pressAndHold(KeyboardKey.A, const Duration(milliseconds: 30));
This example shows a key being pressed a determinated times.
Keyboard keyboard = Keyboard();
keyboard.pressTimes(KeyboardKey.G, 2);
See also: KeyboardKey
Keyboard({this.enabled = true});
Name | Description |
---|---|
enabled |
Enable/Disable the keyboard to accept inputs. |
Name | Description |
---|---|
void press(KeyboardKey keyInput) |
Simualte a keystroke. |
void pressTimes(KeyboardKey keyInput, int pressTimes) |
Simulate a keystroke a few times. |
Future pressAndHold(KeyboardKey keyInput, Duration duration) async |
Simualte a keystroke and hold the key until the duration ends. |