mouseX property Null safety

num mouseX

The x-coordinate of the mouse relative to the local coordinate system of the display object.

If you need both mouseX and mouseY, it is more efficient to use the mousePosition getter.

Implementation

num get mouseX {
  final mp = mousePosition;
  return (mp != null) ? mp.x : 0.0;
}