subChecked method

U8 subChecked(
  1. U8 other
)

Subtracts other catching underflow.

Implementation

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