typeText method

  1. @override
Future<void> typeText(
  1. String text, {
  2. int? keyDelayMs,
})
override

ASCII goes key by key; other text goes through the pasteboard, which the hardware keyboard cannot type.

Implementation

@override
Future<void> typeText(String text, {int? keyDelayMs}) =>
    text.codeUnits.every((c) => c >= 0x20 && c < 0x7f || c == 0x0a || c == 0x09)
        ? _call({'cmd': 'type', 'text': text, if (keyDelayMs != null) 'keyDelayMs': keyDelayMs},
            extraMs: text.length * ((keyDelayMs ?? 12) + 20))
        : _paste(text);