operator + method

  1. @override
u1 operator +(
  1. dynamic other
)
override

Adds other to this number.

If the other number is double, the value is truncated after addition

Returns u1

Implementation

@override
u1 operator +(dynamic other) {
  if (other is integer) {
    return u1(value + other.value);
  } else if (other is int) {
    return u1(value + other);
  } else if (other is double) {
    return u1((value + other).truncate());
  } else {
    throw Exception('Invalid type for operand: ${other.runtimeType}');
  }
}