set method Null safety

void set (
  1. dynamic v
)

Set byte to number or boolean

Implementation

void set(dynamic v) {
  if (v is bool) {
    v = v ? 1 : 0;
  } else if (!(v is int)) {
    throw _gen
        .error('You must give a boolean or a number to the set function');
  }
  if (v > 127 || v < -128) {
    throw _gen.error('Byte must be between -128 and 127');
  }
  _number = v;
}