mulChecked method

U16 mulChecked(
  1. U16 other
)

Multiplies by other catching overflow.

Implementation

U16 mulChecked(U16 other) {
  var result = value * other.value;
  if (result > 65535) {
    throw StateError('U16 multiplication overflow');
  }
  return U16(result);
}