readBool method

bool readBool()

Decodes a boolean value (0 = false, 1 = true)

Throws FormatException if the byte is not 0 or 1.

Example:

final flag = decoder.readBool();

Implementation

bool readBool() {
  final byte = readU8();
  if (byte > 1) {
    throw SpacetimeDbProtocolException(
      'Invalid boolean value: $byte (expected 0 or 1)',
    );
  }
  return byte == 1;
}