subChecked method

U16 subChecked(
  1. U16 other
)

Subtracts other catching underflow.

Implementation

U16 subChecked(U16 other) {
  var result = value - other.value;
  if (result < 0) {
    throw StateError('U16 subtraction underflow');
  }
  return U16(result);
}