operator - method

Point operator -(
  1. Point other
)

Overrides the subtraction (-) operator.

Subtracts the x, y, and z coordinates of other point from the coordinates of this point. If z is null for any of the points, the resulting point will be 2-dimensional.

Example:

var point1 = Point(2, 2);
var point2 = Point(1, 1);
print(point1 - point2); // Output: Point(1.0, 1.0)

Returns a new Point.

Implementation

Point operator -(Point other) => Point(x - other.x, y - other.y,
    z != null && other.z != null ? z! - other.z! : null);