validateBoolean function
Shortcut for a validator to assert that the data is a single byte equal to 1 or 0
Implementation
Validator validateBoolean() {
return validate(
(bytes) =>
bytes.byteLength == 1 &&
(bytes.toBytes().first == 0 || bytes.toBytes().first == 1),
(bytes) => ArgumentError(
"Provided data is not a a single byte equal to 1 or 0."));
}