addChecked method

I64 addChecked(
  1. I64 other
)

Implementation

I64 addChecked(I64 other) {
  var result = (value + other.value).toSigned(64);
  // Overflow occurs if both operands have the same sign, but the result has a different sign.
  if (_sameSign(value, other.value) && !_sameSign(value, result)) {
    throw StateError('I64 addition overflow');
  }
  return I64(result);
}