operator - method

  1. @override
i16 operator -(
  1. dynamic other
)
override

Subtracts other from this number.

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

Returns i16

Implementation

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