addChecked method

U16 addChecked(
  1. U16 other
)

Adds other catching overflow.

Implementation

U16 addChecked(U16 other) {
  var result = value + other.value;
  if (result > 65535) {
    throw StateError('U16 addition overflow');
  }
  return U16(result);
}