isNodeOffScreen method Null safety

bool isNodeOffScreen(
  1. Rect paintBounds,
  2. FlutterView window
)

Returns if a rectangle of node is off the screen.

Allows node to be of screen partially before culling the node.

Implementation

bool isNodeOffScreen(Rect paintBounds, ui.FlutterView window) {
  final Size windowPhysicalSize = window.physicalSize * window.devicePixelRatio;
  return paintBounds.top < -50.0 ||
         paintBounds.left < -50.0 ||
         paintBounds.bottom > windowPhysicalSize.height + 50.0 ||
         paintBounds.right > windowPhysicalSize.width + 50.0;
}