swipeBack method

Future<void> swipeBack({
  1. double dy = 0.5,
  2. String? appId,
})

Mimics the swipe back (left to right) gesture.

dy determines the vertical offset of the swipe. It must be in the inclusive 0-1 range.

appId is only used on iOS, where native queries must be scoped to a single application. If not provided, defaults to the bundle id of the app under test.

This is equivalent to: $.native.swipe( from: Offset(0, dy), to: Offset(1, dy), appId: appId, );

On Android, navigation with gestures might have to be turned on in devices settings.

Example usage:

await tester.swipeBack(dy: 0.8); // Swipe back at 1/5 height of the screen
await tester.swipeBack(); // Swipe back at the center of the screen

Implementation

Future<void> swipeBack({double dy = 0.5, String? appId}) {
  return platform.action.mobile(
    android: () => platform.android.swipeBack(dy: dy),
    ios: () => platform.ios.swipeBack(dy: dy, appId: appId),
  );
}