Vector2 class

Vector2

A simple 2D vector class for representing points or directions in a 2D space.

Constructors

Vector2.new(double x, double y)
const
Vector2.fromOffset(Offset offset)
Create from Flutter's Offset
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
x double
final
y double
final

Methods

add(Vector2 other) Vector2
copy() Vector2
Creates a new instance with the same values.
copyWith({double? x, double? y}) Vector2
Creates a new instance with optional updates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toOffset() Offset
Convert to Offset (optional but useful)
toString() String
A string representation of this object.
override

Operators

operator *(double scalar) Vector2
operator +(Vector2 other) Vector2
operator -(Vector2 other) Vector2
operator /(double scalar) Vector2
operator ==(Object other) bool
The equality operator.
override

Constants

zero → const Vector2