getBounds method Null safety

Rectangle<num> getBounds(
  1. DisplayObject targetSpace
)

Returns the bounds of this display object relative to the specified targetSpace.

This method may return ┬┤null┬┤ if this display objects has no relation to the targetSpace.

Implementation

Rectangle<num> getBounds(DisplayObject targetSpace) {
  final rectangle = bounds;
  final matrix = getTransformationMatrix3D(targetSpace);
  return matrix.transformRectangle(rectangle, rectangle);
}