TestGesture constructor Null safety

TestGesture(
  1. {required EventDispatcher dispatcher,
  2. int pointer = 1,
  3. PointerDeviceKind kind = PointerDeviceKind.touch,
  4. int? device,
  5. int buttons = kPrimaryButton}
)

Create a TestGesture without dispatching any events from it. The TestGesture can then be manipulated to perform future actions.

By default, the pointer identifier used is 1. This can be overridden by providing the pointer argument.

A function to use for hit testing must be provided via the hitTester argument, and a function to use for dispatching events must be provided via the dispatcher argument.

The device kind defaults to PointerDeviceKind.touch, but move events when the pointer is "up" require a kind other than PointerDeviceKind.touch, like PointerDeviceKind.mouse, for example, because touch devices can't produce movement events when they are "up".

None of the arguments may be null. The dispatcher and hitTester arguments are required.

Implementation

TestGesture({
  required EventDispatcher dispatcher,
  int pointer = 1,
  PointerDeviceKind kind = PointerDeviceKind.touch,
  int? device,
  int buttons = kPrimaryButton,
}) : _dispatcher = dispatcher,
     _pointer = TestPointer(pointer, kind, device, buttons);