tap method Null safety

Future<void> tap(
  1. Finder finder,
  2. {int? pointer,
  3. int buttons = kPrimaryButton,
  4. bool warnIfMissed = true}
)

Dispatch a pointer down / pointer up sequence at the center of the given widget, assuming it is exposed.

The warnIfMissed argument, if true (the default), causes a warning to be displayed on the console if the specified Finder indicates a widget and location that, were a pointer event to be sent to that location, would not actually send any events to the widget (e.g. because the widget is obscured, or the location is off-screen, or the widget is transparent to pointer events).

Set the argument to false to silence that warning if you intend to not actually hit the specified element.

For example, a test that verifies that tapping a disabled button does not trigger the button would set warnIfMissed to false, because the button would ignore the tap.

Implementation

Future<void> tap(Finder finder, {int? pointer, int buttons = kPrimaryButton, bool warnIfMissed = true}) {
  return tapAt(getCenter(finder, warnIfMissed: warnIfMissed, callee: 'tap'), pointer: pointer, buttons: buttons);
}