tapAt method

Future<void> tapAt(
  1. Offset location, {
  2. String? appId,
})

Taps at a given location.

location must be in the inclusive 0-1 range.

Implementation

Future<void> tapAt(Offset location, {String? appId}) async {
  assert(location.dx >= 0 && location.dx <= 1);
  assert(location.dy >= 0 && location.dy <= 1);

  // Needed for an edge case observed on Android where if a newly opened app
  // updates its layout right after being launched, tapping without delay fails
  await Future<void>.delayed(const Duration(milliseconds: 5));

  await _wrapRequest('tapAt', () async {
    await _client.tapAt(
      TapAtRequest(
        x: location.dx,
        y: location.dy,
        appId: appId ?? resolvedAppId,
      ),
    );
  });
}