addBool method

void addBool(
  1. int field,
  2. bool? value, [
  3. bool? def
])

Add the field with the given boolean value. The field is not added if the value is equal to def. Booleans are stored as 8-bit fields with 0 for false and 1 for true.

Implementation

void addBool(int field, bool? value, [bool? def]) {
  assert(_inVTable);
  if (value != null && value != def) {
    _prepare(_sizeofUint8, 1);
    _trackField(field);
    _buf.setInt8(_buf.lengthInBytes - _tail, value ? 1 : 0);
  }
}