write method

  1. @override
void write(
  1. QRBitBuffer buffer
)
override

Implementation

@override
void write(QRBitBuffer buffer) {
  // Walk through the list of number; attempting to encode up to 3 at a time.
  // Write (N *3 + 1) bits.
  final leftOver = _data.length % 3;

  final efficientGrab = _data.length - leftOver;
  for (var i = 0; i < efficientGrab; i += 3) {
    final encoded = _data[i] * 100 + _data[i + 1] * 10 + _data[i + 2];
    buffer.put(encoded, 10);
  }
  if (leftOver > 1) {
    // 2 bytes
    buffer.put(_data[_data.length - 2] * 10 + _data[_data.length - 1], 7);
  } else if (leftOver > 0) {
    // 1 byte
    buffer.put(_data.last, 4);
  }
}