operator + method

Byte operator +(
  1. Byte other
)

Adds two Byte values.

Both operands must represent single bytes.

Example:

final a = Byte(10);
final b = Byte(20);
final sum = a + b;
print(sum.value);  // 30

Throws NoGuaranteeException if either operand represents multiple bytes. Throws InvalidArgumentException if result is outside byte range.

Implementation

Byte operator +(Byte other) {
  if (!isSingleByte || !other.isSingleByte) {
    throw NoGuaranteeException('Arithmetic operations only supported for single bytes');
  }
  return Byte(_bytes[0] + other._bytes[0]);
}