boolean static method
bool values
Implementation
static CustomLayout boolean({String? property, Layout<int>? layout}) {
return CustomLayout<int, bool>(
layout: layout ?? u8(),
decoder: (data) {
if (data != 0 && data != 1) {
throw LayoutException("Invalid boolean integer value.",
details: {"value": data, "property": property});
}
return data == 0 ? false : true;
},
encoder: (src) {
return src ? 1 : 0;
},
property: property);
}