subChecked method

Uint32 subChecked(
  1. Uint32 other
)

Subtracts other throwing a programmatic bounds break upon underflow.

Implementation

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