mulChecked method

I64 mulChecked(
  1. I64 other
)

Implementation

I64 mulChecked(I64 other) {
  if (value == 0 || other.value == 0) return I64(0);
  var result = (value * other.value).toSigned(64);
  if (result ~/ other.value != value) {
    throw StateError('I64 multiplication overflow');
  }
  return I64(result);
}