Offset class final

A 2D offset relative to the top left corner of a coordinate space.

  • The x-axis is horizontal increasing to the right.
  • The y-axis is vertical increasing downwards.

Equality

Two offsets are equal if their x and y coordinates are equal.

Comparison

Offsets are ordered in relation to their x and y coordinates.

That is, an offset in the top-left corner is less than an offset in the bottom-right corner. If two offsets have the same y coordinate, the one with the smaller x coordinate is less, and vice versa.

If both coordinates are different, the offset with the smaller y coordinate is less. If both coordinates are equal, the offsets are equal.

Implemented types
Annotations

Constructors

Offset(int x, int y)
Creates a new offset.
const
Offset.from((int, int) pair)
Creates a new offset from a coordinate pair (x, y).
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 int
X-coordinate of this offset.
final
y int
Y-coordinate of this offset.
final

Methods

compareTo(Offset other) int
Compares this object to another object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toPair() → (int, int)
Returns a pair (x, y) of this offset.
toString() String
A string representation of this object.
override

Operators

operator +(Offset other) Offset
Returns this offset incremented by the provided other offset.
operator -(Offset other) Offset
Returns this offset decremented by the provided other offset.
operator ==(Object other) bool
The equality operator.
override

Constants

zero → const Offset
The zero offset, or origin.