Point<T extends num> class
A utility class for representing two-dimensional positions.
Example:
var leftTop = const Point(0, 0);var rightBottom = const Point(200, 400);Legacy: New usages ofPoint are discouraged.
- If you are using the
Pointclass withdart:html,we recommend migrating topackage:web.To learn how and why to migrate,check out themigration guide. - If you want to combine an
xandycoordinate,consider using arecord.Depending on how you will use it, this could looklikevar point = (x, y)orvar point = (x: x, y: y). - If you want to perform vector operations,like vector addition or scalar multiplication,consider using a dedicated vector math library,such as
package:vector_math. - If you are developing a Flutter application or package,consider using the
Offsettype fromdart:ui.
Constructors
- Point(Tx,Ty)
- Creates a point with the provided
xandycoordinates.const
Properties
Methods
- distanceTo(
Point< T> other)→double - Returns the distance between
thisandother. - noSuchMethod(
Invocationinvocation)→ dynamic - Invoked when a nonexistent method or property is accessed.inherited
- squaredDistanceTo(
Point< T> other)→ T - Returns the squared distance between
thisandother. - toString(
)→String - A string representation of this object.override
Operators
- operator *(
numfactor)→Point< T> - Scale this point by
factoras if it were a vector. - operator +(
Point< T> other)→Point<T> - Add
othertothis, as if both points were vectors. - operator -(
Point< T> other)→Point<T> - Subtract
otherfromthis, as if both points were vectors. - operator ==(
Objectother)→bool - Whether
otheris a point with the same coordinates as this point.override