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 2 at a time.
  // Write (N *5 + 1) bits.
  final leftOver = _string.length % 2;

  final efficientGrab = _string.length - leftOver;
  for (var i = 0; i < efficientGrab; i += 2) {
    final encoded = encodeArray[_string.codeUnitAt(i)]! * 45 +
        encodeArray[_string.codeUnitAt(i + 1)]!;
    buffer.put(encoded, 11);
  }
  if (leftOver > 0) {
    // N*5 + 1 = 6
    buffer.put(encodeArray[_string.codeUnitAt(_string.length - 1)]!, 6);
  }
}