operator + method

Quaternion operator +(
  1. Object other
)

Returns the sum of this number and another one.

Implementation

Quaternion operator +(Object other) {
  if (other is Quaternion) {
    return Quaternion(w + other.w, x + other.x, y + other.y, z + other.z);
  } else if (other is num) {
    return Quaternion(w + other, x, y, z);
  } else {
    throw ArgumentError.value(other, 'other', 'Invalid type');
  }
}