QrPainter.withQr constructor

QrPainter.withQr({
  1. required QrCode qr,
  2. Color? color = _qrDefaultColor,
  3. Color? emptyColor,
  4. bool gapless = false,
  5. Image? embeddedImage,
  6. QrEmbeddedImageStyle? embeddedImageStyle,
  7. QrEyeStyle eyeStyle = const QrEyeStyle(eyeShape: QrEyeShape.square, color: Color(0xFF000000)),
  8. QrDataModuleStyle dataModuleStyle = const QrDataModuleStyle(dataModuleShape: QrDataModuleShape.square, color: Color(0xFF000000)),
})

Create a new QrPainter with a pre-validated/created QrCode object. This constructor is useful when you have a custom validation / error handling flow or for when you need to pre-validate the QR data.

Implementation

QrPainter.withQr({
  required QrCode qr,
  this.color = _qrDefaultColor,
  this.emptyColor,
  this.gapless = false,
  this.embeddedImage,
  this.embeddedImageStyle,
  this.eyeStyle = const QrEyeStyle(
    eyeShape: QrEyeShape.square,
    color: Color(0xFF000000),
  ),
  this.dataModuleStyle = const QrDataModuleStyle(
    dataModuleShape: QrDataModuleShape.square,
    color: Color(0xFF000000),
  ),
})  : _qr = qr,
      version = qr.typeNumber,
      errorCorrectionLevel = qr.errorCorrectLevel {
  _calcVersion = version;
  _initPaints();
}