subChecked method

U32 subChecked(
  1. U32 other
)

Subtracts other catching underflow.

Implementation

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