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.unknown:
    default: // ignore: no_default_cases, to allow adding new device types to [PointerDeviceKind]
             // TODO(moffatman): Remove after landing https://github.com/flutter/flutter/issues/23604
      _device = device ?? 0;
      break;
  }
}