NotifyingVector2 class
Extension of the standard Vector2 class, implementing the ChangeNotifier functionality. This allows any interested party to be notified when the value of this vector changes.
This class can be used as a regular Vector2 class. However, if you do subscribe to notifications, don't forget to eventually unsubscribe in order to avoid resource leaks.
Direct modification of this vector's storage is not allowed.
- Inheritance
- Mixed-in types
- Available extensions
Constructors
- NotifyingVector2(double x, double y)
-
factory
- NotifyingVector2.all(double v)
-
factory
- NotifyingVector2.copy(Vector2 v)
-
factory
- NotifyingVector2.zero()
Properties
- g ↔ double
-
getter/setter pairinherited
- gg → Vector2
-
no setterinherited
- ggg → Vector3
-
no setterinherited
- gggg → Vector4
-
no setterinherited
- gggr → Vector4
-
no setterinherited
- ggr → Vector3
-
no setterinherited
- ggrg → Vector4
-
no setterinherited
- ggrr → Vector4
-
no setterinherited
- gr ↔ Vector2
-
getter/setter pairinherited
- grg → Vector3
-
no setterinherited
- grgg → Vector4
-
no setterinherited
- grgr → Vector4
-
no setterinherited
- grr → Vector3
-
no setterinherited
- grrg → Vector4
-
no setterinherited
- grrr → Vector4
-
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isInfinite → bool
-
True if any component is infinite.
no setterinherited
- isNaN → bool
-
True if any component is NaN.
no setterinherited
- length ↔ double
-
Length.
getter/setter pairinherited-getteroverride-setter
- length2 → double
-
Length squared.
no setterinherited
- r ↔ double
-
getter/setter pairinherited
- rg ↔ Vector2
-
getter/setter pairinherited
- rgg → Vector3
-
no setterinherited
- rggg → Vector4
-
no setterinherited
- rggr → Vector4
-
no setterinherited
- rgr → Vector3
-
no setterinherited
- rgrg → Vector4
-
no setterinherited
- rgrr → Vector4
-
no setterinherited
- rr → Vector2
-
no setterinherited
- rrg → Vector3
-
no setterinherited
- rrgg → Vector4
-
no setterinherited
- rrgr → Vector4
-
no setterinherited
- rrr → Vector3
-
no setterinherited
- rrrg → Vector4
-
no setterinherited
- rrrr → Vector4
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- s ↔ double
-
getter/setter pairinherited
- ss → Vector2
-
no setterinherited
- sss → Vector3
-
no setterinherited
- ssss → Vector4
-
no setterinherited
- ssst → Vector4
-
no setterinherited
- sst → Vector3
-
no setterinherited
- ssts → Vector4
-
no setterinherited
- sstt → Vector4
-
no setterinherited
- st ↔ Vector2
-
getter/setter pairinherited
- storage → Float64List
-
The components of the vector.
no setteroverride
- sts → Vector3
-
no setterinherited
- stss → Vector4
-
no setterinherited
- stst → Vector4
-
no setterinherited
- stt → Vector3
-
no setterinherited
- stts → Vector4
-
no setterinherited
- sttt → Vector4
-
no setterinherited
- t ↔ double
-
getter/setter pairinherited
- ts ↔ Vector2
-
getter/setter pairinherited
- tss → Vector3
-
no setterinherited
- tsss → Vector4
-
no setterinherited
- tsst → Vector4
-
no setterinherited
- tst → Vector3
-
no setterinherited
- tsts → Vector4
-
no setterinherited
- tstt → Vector4
-
no setterinherited
- tt → Vector2
-
no setterinherited
- tts → Vector3
-
no setterinherited
- ttss → Vector4
-
no setterinherited
- ttst → Vector4
-
no setterinherited
- ttt → Vector3
-
no setterinherited
- ttts → Vector4
-
no setterinherited
- tttt → Vector4
-
no setterinherited
- x ↔ double
-
getter/setter pairinherited-getteroverride-setter
- xx → Vector2
-
no setterinherited
- xxx → Vector3
-
no setterinherited
- xxxx → Vector4
-
no setterinherited
- xxxy → Vector4
-
no setterinherited
- xxy → Vector3
-
no setterinherited
- xxyx → Vector4
-
no setterinherited
- xxyy → Vector4
-
no setterinherited
- xy ↔ Vector2
-
getter/setter pairinherited-getteroverride-setter
- xyx → Vector3
-
no setterinherited
- xyxx → Vector4
-
no setterinherited
- xyxy → Vector4
-
no setterinherited
- xyy → Vector3
-
no setterinherited
- xyyx → Vector4
-
no setterinherited
- xyyy → Vector4
-
no setterinherited
- y ↔ double
-
getter/setter pairinherited-getteroverride-setter
- yx ↔ Vector2
-
getter/setter pairinherited-getteroverride-setter
- yxx → Vector3
-
no setterinherited
- yxxx → Vector4
-
no setterinherited
- yxxy → Vector4
-
no setterinherited
- yxy → Vector3
-
no setterinherited
- yxyx → Vector4
-
no setterinherited
- yxyy → Vector4
-
no setterinherited
- yy → Vector2
-
no setterinherited
- yyx → Vector3
-
no setterinherited
- yyxx → Vector4
-
no setterinherited
- yyxy → Vector4
-
no setterinherited
- yyy → Vector3
-
no setterinherited
- yyyx → Vector4
-
no setterinherited
- yyyy → Vector4
-
no setterinherited
Methods
-
absolute(
) → void -
Absolute value.
override
-
absoluteError(
Vector2 correct) → double -
Absolute error between this and
correct
inherited -
add(
Vector2 arg) → void -
Add
arg
to this.override -
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addScaled(
Vector2 arg, double factor) → void -
Add
arg
scaled byfactor
to this.override -
angleTo(
Vector2 other) → double -
Returns the angle between this vector and
other
in radians.inherited -
angleToSigned(
Vector2 other) → double -
Returns the signed angle between this and
other
in radians.inherited -
ceil(
) → void -
Ceil entries in this.
override
-
clamp(
Vector2 min, Vector2 max) → void -
Clamp each entry n in this in the range [min
n
]-[maxn
].override -
clamp(
Vector2 min, Vector2 max) → void -
Available on Vector2, provided by the Vector2Extension extension
Clamps this vector so that it is within or equals to the bounds defined bymin
andmax
. -
clampLength(
double min, double max) → void -
Available on Vector2, provided by the Vector2Extension extension
Clamps the length of this vector. -
clampScalar(
double min, double max) → void -
Clamp entries this in the range
min
-max
.override -
clone(
) → Vector2 -
Clone of this.
inherited
-
copyFromArray(
List< double> array, [int offset = 0]) → void -
Copies elements from
array
into this starting atoffset
.override -
copyInto(
Vector2 arg) → Vector2 -
Copy this into
arg
. Returnsarg
.inherited -
copyIntoArray(
List< double> array, [int offset = 0]) → void -
Copies this into
array
starting atoffset
.inherited -
cross(
Vector2 other) → double -
Cross product.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
distanceTo(
Vector2 arg) → double -
Distance from this to
arg
inherited -
distanceToSquared(
Vector2 arg) → double -
Squared distance from this to
arg
inherited -
divide(
Vector2 arg) → void -
Divide entries in this with entries in
arg
.override -
dot(
Vector2 other) → double -
Inner product.
inherited
-
floor(
) → void -
Floor entries in this.
override
-
invert(
) → void -
Available on Vector2, provided by the Vector2Extension extension
Inverts the vector. -
inverted(
) → Vector2 -
Available on Vector2, provided by the Vector2Extension extension
Returns the inverse of this vector. -
isIdentity(
) → bool -
Available on Vector2, provided by the Vector2Extension extension
Whether the Vector2 is the identity vector or not -
isZero(
) → bool -
Available on Vector2, provided by the Vector2Extension extension
Whether the Vector2 is the zero vector or not -
lerp(
Vector2 to, double t) → void -
Available on Vector2, provided by the Vector2Extension extension
Linearly interpolate towards another Vector2 -
moveToTarget(
Vector2 target, double ds) → void -
Available on Vector2, provided by the Vector2Extension extension
Smoothly moves this Vector2 in the directiontarget
by a displacement given by a distanceds
in that direction. -
multiply(
Vector2 arg) → void -
Multiply entries in this with entries in
arg
.override -
negate(
) → void -
Negate.
override
-
normalize(
) → double -
Normalize this.
override
-
normalized(
) → Vector2 -
Normalized copy of this.
inherited
-
normalizeInto(
Vector2 out) → Vector2 -
Normalize vector into
out
.inherited -
normalizeLength(
) → double -
Normalize this. Returns length of vector before normalization.
DEPRECATED: Use normalize.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
postmultiply(
Matrix2 arg) → void -
Transforms this into the product of this as a row vector,
postmultiplied by matrix,
arg
. Ifarg
is a rotation matrix, this is a computational shortcut for applying, the inverse of the transformation.override -
projection(
Vector2 other, {Vector2? out}) → Vector2 -
Available on Vector2, provided by the Vector2Extension extension
Project this ontoother
. -
reflect(
Vector2 normal) → void -
Reflect this.
inherited
-
reflected(
Vector2 normal) → Vector2 -
Reflected copy of this.
inherited
-
relativeError(
Vector2 correct) → double -
Relative error between this and
correct
inherited -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
rotate(
double angle, {Vector2? center}) → void -
Available on Vector2, provided by the Vector2Extension extension
Rotates the Vector2 withangle
in radians rotates aroundcenter
if it is defined In a screen coordinate system (where the y-axis is flipped) it rotates in a clockwise fashion In a normal coordinate system it rotates in a counter-clockwise fashion -
round(
) → void -
Round entries in this.
override
-
roundToZero(
) → void -
Round entries in this towards zero.
override
-
scale(
double arg) → void -
Scale this by
arg
.override -
scaled(
double arg) → Vector2 -
Return a copy of this scaled by
arg
.inherited -
scaleOrthogonalInto(
double scale, Vector2 out) → Vector2 -
Rotate this by 90 degrees then scale it. Store result in
out
. Returnout
.inherited -
scaleTo(
double newLength) → void -
Available on Vector2, provided by the Vector2Extension extension
Changes the length of the vector to the length provided, without changing direction. -
screenAngle(
) → double -
Available on Vector2, provided by the Vector2Extension extension
Signed angle in a coordinate system where the Y-axis is flipped. -
setAll(
double value) → void -
Available on Vector2, provided by the Vector2Extension extension
Sets both x and y tovalue
. -
setFrom(
Vector2 other) → void -
Set the values by copying them from
other
.override -
setValues(
double x_, double y_) → void -
Set the values of the vector.
override
-
setZero(
) → void -
Zero the vector.
override
-
splat(
double arg) → void -
Splat
arg
into all lanes of the vector.override -
sub(
Vector2 arg) → void -
Subtract
arg
from this.override -
taxicabDistanceTo(
Vector2 other) → double -
Available on Vector2, provided by the Vector2Extension extension
Distance toother
vector, using the taxicab (L1) geometry. -
toOffset(
) → Offset -
Available on Vector2, provided by the Vector2Extension extension
Creates an Offset from the Vector2 -
toPoint(
) → Point< num> -
Available on Vector2, provided by the Vector2Extension extension
Creates a Point from the Vector2 -
toPositionedRect(
Vector2 size) → Rect -
Available on Vector2, provided by the Vector2Extension extension
Creates a Rect starting from (x, y) and having the size of the argument Vector2 -
toRect(
) → Rect -
Available on Vector2, provided by the Vector2Extension extension
Creates a Rect starting in origin and going the Vector2 -
toSize(
) → Size -
Available on Vector2, provided by the Vector2Extension extension
Creates a Size from the Vector2 -
toString(
) → String -
Returns a printable string
inherited
-
toStringWithMaxPrecision(
int maxPrecision) → String -
Available on Vector2, provided by the Vector2Extension extension
Stringifies the Vector2 with a maximum precision ofmaxPrecision
. -
translate(
double x, double y) → void -
Available on Vector2, provided by the Vector2Extension extension
Translates this Vector2 byx
andy
. -
translated(
double x, double y) → Vector2 -
Available on Vector2, provided by the Vector2Extension extension
Creates a new Vector2 that is the current Vector2 translated byx
andy
.
Operators
-
operator %(
Vector2 mod) → Vector2 -
Available on Vector2, provided by the Vector2Extension extension
Modulo/Remainder -
operator &(
Vector2 size) → Rect -
Available on Vector2, provided by the Vector2Extension extension
A rectangle constructor operator. -
operator *(
double scale) → Vector2 -
Scale.
inherited
-
operator +(
Vector2 other) → Vector2 -
Add two vectors.
inherited
-
operator -(
Vector2 other) → Vector2 -
Subtract two vectors.
inherited
-
operator /(
double scale) → Vector2 -
Scale.
inherited
-
operator ==(
Object other) → bool -
Check if two vectors are the same.
inherited
-
operator [](
int i) → double -
Access the component of the vector at the index
i
.inherited -
operator []=(
int i, double v) → void -
Set the component of the vector at the index
i
.override -
operator unary-(
) → Vector2 -
Negate.
inherited