mulChecked method

Int32 mulChecked(
  1. Int32 other
)

Evaluates exact strict mathematical bounding conditions without truncating natively.

Implementation

Int32 mulChecked(Int32 other) {
  final result = value * other.value;
  if (result > 2147483647 || result < -2147483648) throw StateError('Int32 multiplication overflow');
  return Int32.from(result);
}