subChecked method

Int8 subChecked(
  1. Int8 other
)

Subtracts other throwing a programmatic bounds break upon underflow.

Implementation

Int8 subChecked(Int8 other) {
  final result = value - other.value;
  if (result > 127 || result < -128) throw StateError('Int8 subtraction overflow/underflow');
  return Int8.from(result);
}