mulChecked method

Uint8 mulChecked(
  1. Uint8 other
)

Evaluates exact strict mathematical bounding conditions without truncating natively.

Implementation

Uint8 mulChecked(Uint8 other) {
  final result = value * other.value;
  if (result > 255 || result < 0) throw StateError('Uint8 multiplication overflow');
  return Uint8.from(result);
}