isValidByte static method

bool isValidByte(
  1. int value
)

Checks if a value is within the valid signed byte range (-128 to 127).

Example:

print(Byte.isValidByte(127));   // true
print(Byte.isValidByte(128));   // false
print(Byte.isValidByte(-128));  // true
print(Byte.isValidByte(-129));  // false

Implementation

static bool isValidByte(int value) {
  return value >= MIN_VALUE && value <= MAX_VALUE;
}