swipe method

Future<void> swipe({
  1. required Offset from,
  2. required Offset to,
  3. int steps = 12,
  4. String? appId,
})

Swipes from from to to.

from and to must be in the inclusive 0-1 range.

On Android, steps controls speed and smoothness. One unit of steps is equivalent to 5 ms. If you want to slow down the swipe time, increase steps. If swipe doesn't work, try increasing steps.

Implementation

Future<void> swipe({
  required Offset from,
  required Offset to,
  int steps = 12,
  String? appId,
}) async {
  assert(from.dx >= 0 && from.dx <= 1);
  assert(from.dy >= 0 && from.dy <= 1);

  await _wrapRequest(
    'swipe',
    () => _client.swipe(
      SwipeRequest(
        startX: from.dx,
        startY: from.dy,
        endX: to.dx,
        endY: to.dy,
        steps: steps,
        appId: appId ?? resolvedAppId,
      ),
    ),
  );
}