TestPointer constructor Null safety

TestPointer(
  1. [int pointer = 1,
  2. PointerDeviceKind kind = PointerDeviceKind.touch,
  3. int? device,
  4. int buttons = kPrimaryButton]
)

Creates a TestPointer. By default, the pointer identifier used is 1, however this can be overridden by providing an argument to the constructor.

Multiple TestPointers created with the same pointer identifier will interfere with each other if they are used in parallel.

Implementation

TestPointer([
  this.pointer = 1,
  this.kind = PointerDeviceKind.touch,
  int? device,
  int buttons = kPrimaryButton,
]) : _buttons = buttons {
  switch (kind) {
    case PointerDeviceKind.mouse:
      _device = device ?? 1;
      break;
    case PointerDeviceKind.stylus:
    case PointerDeviceKind.invertedStylus:
    case PointerDeviceKind.touch:
    case PointerDeviceKind.trackpad:
    case PointerDeviceKind.unknown:
      _device = device ?? 0;
      break;
  }
}