transformed method Null safety

  1. @override
PointerDownEvent transformed(
  1. Matrix4? transform

Transforms the event from the global coordinate space into the coordinate space of an event receiver.

The coordinate space of the event receiver is described by transform. A null value for transform is treated as the identity transformation.

The resulting event will store the base event as original, delegates most properties to original, except for localPosition and localDelta, which are calculated based on transform on first use and cached.

The method may return the same object instance if for example the transformation has no effect on the event. Otherwise, the resulting event will be a subclass of, but not exactly, the original event class (e.g. PointerDownEvent.transformed may return a subclass of PointerDownEvent).

Transforms are not commutative, and are based on original events. If this method is called on a transformed event, the provided transform will override (instead of multiplied onto) the existing transform and used to calculate the new localPosition and localDelta.


PointerDownEvent transformed(Matrix4? transform) {
  if (transform == null || transform == this.transform) {
    return this;
  return _TransformedPointerDownEvent(original as PointerDownEvent? ?? this, transform);