setDownInfo method Null safety

bool setDownInfo(
  1. PointerEvent event,
  2. Offset newLocation,
  3. {int? buttons}
)

If a custom event is created outside of this class, this function is used to set the isDown.

Implementation

bool setDownInfo(
  PointerEvent event,
  Offset newLocation, {
  int? buttons,
}) {
  _location = newLocation;
  if (buttons != null)
    _buttons = buttons;
  switch (event.runtimeType) {
    case PointerDownEvent:
      assert(!isDown);
      _isDown = true;
      break;
    case PointerUpEvent:
    case PointerCancelEvent:
      assert(isDown);
      _isDown = false;
      break;
    default:
      break;
  }
  return isDown;
}