addChecked method

Int8 addChecked(
  1. Int8 other
)

Adds other dynamically intercepting any numerical layout overflow triggering a Dart StateError.

Implementation

Int8 addChecked(Int8 other) {
  final result = value + other.value;
  if (result > 127 || result < -128) throw StateError('Int8 addition overflow');
  return Int8.from(result);
}