printQrCode static method

void printQrCode(
  1. QrImage qr
)

Print the QR code to the console

Implementation

static void printQrCode(QrImage qr) {
  for (int y = 0; y < qr.moduleCount; y++) {
    String row = '';
    for (int x = 0; x < qr.moduleCount; x++) {
      row += qr.isDark(y, x)
          ? '██'
          : '  '; // Use '██' for black and '  ' for white
    }
    print(row);
  }
}