Point<T extends num> class
Null safety
A utility class for representing two-dimensional positions.
Example:
var leftTop = const Point(0, 0);
var rightBottom = const Point(200, 400);
Constructors
- Point(T x, T y)
-
Creates a point with the provided
x
andy
coordinates.const
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, override
- magnitude → double
-
Get the straight line (Euclidean) distance between the origin (0, 0) and
this point. [...]
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- x → T
-
final
- y → T
-
final
Methods
-
distanceTo(
Point< T> other) → double -
Returns the distance between
this
andother
. [...] -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
squaredDistanceTo(
Point< T> other) → T -
Returns the squared distance between
this
andother
. [...] -
toString(
) → String -
A string representation of this object. [...]
override
Operators
-
operator *(
num factor) → Point< T> -
Scale this point by
factor
as if it were a vector. [...] -
operator +(
Point< T> other) → Point<T> -
Add
other
tothis
, as if both points were vectors. [...] -
operator -(
Point< T> other) → Point<T> -
Subtract
other
fromthis
, as if both points were vectors. [...] -
operator ==(
Object other) → bool -
Whether
other
is a point with the same coordinates as this point. [...]override